🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #2083

Re: Need to store and retrieve a file (any kind) into and from a ADO DB

#2083
From: Alen Markov
Date: Sun, 02 Nov 2003 21:30
78 lines
3152 bytes
Hello Paolo

I'm working on exactly the same.
I have an Access File and want to store pictures into it.
I think we are right to use OLEObject in the Access Table, because if you
use
a DBGrid and access the Access-Table with ADO (and don't set specific
columns to be shown
in the DBGrid - so the DBGrid shows all columns by default), the colum
holding OLEObject
will display "BLOB" (Binary Large OBject - which should be the right one).

To fill that field with BCB5, I took a DBImage-Component from the "Data
Controls" page.

I have this settings for my component DBImage1:

DataSource: DataSource1
DataField: Picture  (<- This is the Access Column OLEObject)

DataSource1 has as DataSet: ADOQuery1

And ADOQuery1 has a ConnectionString where I access through
"Microsoft Jet 4.0 OLE DB Provider" the *.mdb-File


Now what I don't get is:
They write to add a picture into DBImage, you can work with
"Copy'n'paste"...

The only way I found out to add a picture to that DBImage is like this:
Open MSPaint, load a Bitmap picture. Press CTRL-A (to select the whole
picture). Press CTRL-C (to copy the selection) - then click on that
DBImage and press CTRL-V to paste the picture into the DBImage component...

That will save the picture into the Access Database and also work like this

But: Isn't there any other more easy way to fill DBImage with a picture?

I tryed this:
OpenPictureDialog1->execute();
DBImage1->Picture->LoadFromFile(OpenPictureDialog1->FileName);

The result is: The picture is really displayed in my DBImage1-Component now,
but if you click on another Row in the DBGrid and then click back on the
row where you "inserted" the picture with "LoadFromFile" - it's not beeing
displayed anymore :-/

Anybody with a useful hint here?


Best regards,
Alen

-- 
WEB: http://www.come.to/nostromo



"Paolo Borlandi" <pborlandi@virgilio.it> wrote in message
news:3f799037@newsgroups.borland.com...
> I need to store files (any kind) into a db record and retrive it when
asked.
> The db is a Ms Access db.
>
> the field tyte is OLEObject (right?? wrong??)
>
> Have someone some idea or example??
>
> THANK YOU VERY MUCH
>
> Paolo from Italy
>
>
>
>
>
>
Technical Details
Message-ID: <3fa57725$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3f799037@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,78f7fca98722ead5
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2003-11-02 13:39:05 PST
From: "Alen Markov" <NOSPAM_amarkov@gmx.net>
Newsgroups: borland.public.cppbuilder.database.ado
References: <3f799037@newsgroups.borland.com>
Subject: Re: Need to store and retrieve a file (any kind) into and from a ADO DB
Date: Sun, 2 Nov 2003 22:30:47 +0100
Lines: 80
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 80.218.72.163
Message-ID: <3fa57725$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1067808549 80.218.72.163 (2 Nov 2003 13:29:09 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail