Article View: borland.public.cppbuilder.database.ado
Article #4992Re: Reading and Writing to Graphic BLOBs database fields and TImage controls
From: placard
Date: Fri, 17 Aug 2001 08:43
Date: Fri, 17 Aug 2001 08:43
60 lines
2926 bytes
2926 bytes
place a OpenPictureDialog on the form and try this .
void __fastcall TForm1::DBImage1DblClick(TObject *Sender)
{
boolean result;
if (TheTable->State == dsEdit)
{
result = OpenPictureDialog1->Execute();
if (result == true)
{
DBImage1->Picture->LoadFromFile(OpenPictureDialog1->FileName);
}
}
else ShowMessage(" the database is not in edit mode");
Mitchell lebold <lebold@casterra.com> a οΏ½crit dans le message :
3B7C054F.700C4467@casterra.com...
> I have been trying to get the image data from a TImage control into a
> database (Graphic BLOB field) and vise versa. I also don't what to rely
> on the filename of the image file, ie. once I load an image file (bmp,
> wmf, ico) into the TImage control, I don't want to remember the filename
> to load the image file into the database. And for other reasons, I
> would like to use the TImage control instead of the TDBImage Control. I
> haven't seen any examples for this in any books, so any help would be
> greatly appreciated.
> Thanks in advance....
> Mitch
>
> PS. Below are some things that I have been trying but haven't be
> successful.
>
>
> if (ImageNo1->Picture!=NULL){
> // Graphics::TBitmap *Bitmap = new Graphics::TBitmap();
> // Bitmap->Assign(ImageNo1->Picture);
> // DM->GunDataTable->FieldByName("Image#1")->AsBlop = Bitmap;
>
>
file://DM->GunDataTable->FieldByName("Image#1")->Assing(ImageNo1->Picture);
>
> TBlobField* field =
> (TBlobField*)DM->DataTable->FieldByName("Image#1");
> TBlobStream* stream = new TBlobStream(field, bmReadWrite);
> ImageNo1->Picture->Metafile->SaveToStream(stream);
>
> file://TBlobStream *pStream;
> file://pStream =
> DM->DataTable->CreateBlobStream(DM->DataTable->FieldByName("Image#1"),
> bmReadWrite);
> file://ImageNo1->Picture->Metafile->SaveToStream(pStream);
>
> file://delete stream;
> }
>
Technical Details
Message-ID:
<3b7cd907_1@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed1.earthlink.net!newsfeed.earthlink.net!news-hog.berkeley.edu!ucberkeley!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnewsReferences:
<3B7C054F.700C4467@casterra.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 10698b,544e1a93b7b337ce X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2001-08-17 01:45:25 PST From: "placard" <placard@free.fr> Newsgroups: borland.public.cppbuilder.database.ado References: <3B7C054F.700C4467@casterra.com> Subject: Re: Reading and Writing to Graphic BLOBs database fields and TImage controls Date: Fri, 17 Aug 2001 10:43:38 +0200 Lines: 62 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 NNTP-Posting-Host: 193.252.177.168 Message-ID: <3b7cd907_1@dnews> X-Trace: dnews 998037767 193.252.177.168 (17 Aug 2001 01:42:47 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed1.earthlink.net!newsfeed.earthlink.net!news-hog.berkeley.edu!ucberkeley!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews