Article View: borland.public.cppbuilder.database.ado
Article #89Re: Database problem
From: Tomislav Hundric'
Date: Sat, 28 Jul 2007 11:13
Date: Sat, 28 Jul 2007 11:13
83 lines
4486 bytes
4486 bytes
Hi Vassiliev,
thanks on your quick response. I'm sorry if I'm asking too much, but am
I doing it right, I create blank database and table with two fields, ID
(autonumber) and IMG(OLE OBJECT), for starters I'm filling IMG field via
MS Access, so I right click on IMG field and select Insert Object...
Create from file and then I choose .jpg file which I want to add. In
c++builder 6, I have a form with dbImage and button:
I've included:
#include <jpeg.hpp>
and register class on form create event:
DBImage1->Picture->RegisterFileFormat(__classid(TJPEGImage), "jpg",
"JPEG File", __classid(TJPEGImage));
DBImage control AutoDisplay property is set to false, and on buttonClick
event I have:
TBlobField* field = (TBlobField*)ADOQuery1->FieldByName("IMG");
TBlobStream* stream = new TBlobStream(field, bmRead);
TJPEGImage* image = new TJPEGImage;
DBImage1->Picture->Assign(image);
DBImage1->Picture->Graphic->LoadFromStream(stream);
delete stream;
delete image;
When I click on button, I get error "Invalid class typecast", I can't
figure out what's wrong, can you tell me if this approach is ok, or I
should do it in some other way.
Thanks in advance,
Tomislav.
Vassiliev V. V. wrote:
> Access (Jet engine) does support BLOBs. Just in MS Access UI you will see it
> not as OLE object but as binary data (i.e. can not normally view in MS
> Access UI). Inside your application it will be normal BLOB as in most other
> DBMS.
>
> //------------------------------------------
> Regards,
> Vassiliev V. V.
> http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
> ADO.Net
> http://www.oledbdirect.com - The fastest way to access MS SQL Server,
> MS Jet (Access) and Interbase (through OLEDB)
>
>
> "Tomislav Hundric" <rifnet@gmail.com> �������/�������� � �������� ���������:
> news:46aaee61@newsgroups.borland.com...
>> Hi,
>> I have the following situation. I have to develop application that will be
>> used to display images and data from db. My first thought was I'll use ms
>> access db because it is very simple to deploy, only one file and the best
>> part is I don't have to install bde engine since it uses microsoft jet
>> driver which is native in windows, but since ms access doesn't have blob
>> field I have to use OLE object and I found out that it converts jpeg
>> images to bmp and increases size of db dramatically. I know I can use save
>> the path to file in db field and then retrieve the image stored locally,
>> but this is not a good solution to me since I'll be storing hundreds of
>> images so I want to avoid hundreds of files stored locally. My next
>> thought was to use paradox db since it is able to store images in blob
>> field, but I want to avoid installation of bde if possible. I've came
>> across this article which says:
>>
>> Jet 4.0 supports connections to Paradox 3, 4 and 5 only; we do not support
>> later versions. The ADO connection string syntax would be:
>>
>> cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data
>> Source=c:\somepath;" & _ "Extended Properties=Paradox 5.x;"
>>
>> I've tried the connection string above and I get error:
>> Could not find installable ISAM
>>
>> Does anyone know is it possible to connect to paradox db using jet drivers
>> (ADO Connection), or can anyone suggest me which is the best way to solve
>> my problem.
>>
>> Thanks in advance,
>> Tomislav
>
>
Technical Details
Message-ID:
<46ab24f1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<46aaee61@newsgroups.borland.com> <46ab0ca8$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,723ca8957fa3ed73 X-Google-Attributes: gid10698b,public,usenet X-Google-Language: ENGLISH,CP1252 Date: Sat, 28 Jul 2007 13:13:12 +0200 From: Tomislav Hundric' <rifnet@gmail.com> User-Agent: Thunderbird 2.0.0.0 (Windows/20070326) MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.database.ado Subject: Re: Database problem References: <46aaee61@newsgroups.borland.com> <46ab0ca8$1@newsgroups.borland.com> In-Reply-To: <46ab0ca8$1@newsgroups.borland.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit NNTP-Posting-Host: 78.0.149.42 Message-ID: <46ab24f1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1185621233 78.0.149.42 (28 Jul 2007 04:13:53 -0700) Lines: 83 Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail