Article View: borland.public.cppbuilder.database.ado
Article #4989Reading and Writing to Graphic BLOBs database fields and TImage controls
From: Mitchell lebold
Date: Thu, 16 Aug 2001 17:39
Date: Thu, 16 Aug 2001 17:39
35 lines
2275 bytes
2275 bytes
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;
//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);
//TBlobStream *pStream;
//pStream =
DM->DataTable->CreateBlobStream(DM->DataTable->FieldByName("Image#1"),
bmReadWrite);
//ImageNo1->Picture->Metafile->SaveToStream(pStream);
//delete stream;
}
Technical Details
Message-ID:
<3B7C054F.700C4467@casterra.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news-out.nibble.net!news-in.nibble.net!newsfeed1.uni2.dk!newssuck.uni2.dk!dnewsShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,544e1a93b7b337ce,start X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2001-08-16 10:54:18 PST Message-ID: <3B7C054F.700C4467@casterra.com> Date: Thu, 16 Aug 2001 13:39:27 -0400 From: Mitchell lebold <lebold@casterra.com> X-Mailer: Mozilla 4.73 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.database.ado Subject: Reading and Writing to Graphic BLOBs database fields and TImage controls Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 130.203.161.79 X-Trace: dnews 997983912 130.203.161.79 (16 Aug 2001 10:45:12 -0700) Lines: 36 Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news-out.nibble.net!news-in.nibble.net!newsfeed1.uni2.dk!newssuck.uni2.dk!dnews