Article View: borland.public.cppbuilder.database.ado
Article #90Re: Database problem
From: Vassiliev V. V.
Date: Sat, 28 Jul 2007 15:06
Date: Sat, 28 Jul 2007 15:06
102 lines
5766 bytes
5766 bytes
Access saves not only jpeg file but also ActiveX information. So if you save
jpeg from your program and load it later it will work, but save jpeg from
Access UI and load will not work (jpeg should be stored in BLOB with some
offset, for bitmap offset was 78 if I am not wrong but it is not constant),
and save jpeg from your program will not allow to view it from Access UI.
You may look for third-party components to save BLOBs in format compatible
with Access UI. However if you do not need Access UI just work with BLOBs as
from any 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:46ab24f1@newsgroups.borland.com...
> 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:
<46ab5b98@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<46aaee61@newsgroups.borland.com> <46ab0ca8$1@newsgroups.borland.com> <46ab24f1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,723ca8957fa3ed73 X-Google-Attributes: gid10698b,public,usenet X-Google-Language: ENGLISH,ASCII From: "Vassiliev V. V." <support@oledbdirect.com> Newsgroups: borland.public.cppbuilder.database.ado References: <46aaee61@newsgroups.borland.com> <46ab0ca8$1@newsgroups.borland.com> <46ab24f1@newsgroups.borland.com> Subject: Re: Database problem Date: Sat, 28 Jul 2007 19:06:27 +0400 Lines: 103 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3138 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-RFC2646: Format=Flowed; Response X-Antivirus: avast! (VPS 000761-2, 27.07.2007), Outbound message X-Antivirus-Status: Clean NNTP-Posting-Host: 85.93.138.132 Message-ID: <46ab5b98@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1185635224 85.93.138.132 (28 Jul 2007 08:07:04 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail