🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Saving Image to Access Database

#393
From: Michael Corby
Date: Tue, 10 Oct 2006 15:05
41 lines
1880 bytes
Hi

I am trying to save images to an OLE Object field in Microsoft Access
with the following code, but i am getting a couple of compile errors :-

Could not find match for BlobField
LoadFromStream is not a member etc - I think this is because of the first 
message

Code as follows :-

   String pictureName;
   TMemoryStream *stream = new TMemoryStream;
   TBlobField *field = new TBlobField;

   pictureName = "C:\\MC\\Images\\Tulips.jpg";

   stream->LoadFromFile(pictureName);

   field = dynamic_cast<TBlobField *>
           (wDataModule->tPlants->FieldByName("JPGImage"));  // OLE Object 
field in Database

   wDataModule->tPlants->Edit();

//   wDataModule->tPlants->FieldByName("JPGImage")->    // commented out
//               LoadFromStream(stream.get(), ftGraphic);            // 
commented out

   field->LoadFromStream(stream.get(), ftGraphic);

   wDataModule->tPlants->Post();

   delete stream;
   delete field;



Any help appreciated

Michael Corby 
Technical Details
Message-ID: <452bb718@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.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

Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,f1e6d54834bdceb1,start
X-Google-Attributes: gid10698b,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Michael Corby" <mcorby@indigo.ie>
Newsgroups: borland.public.cppbuilder.database.ado
Subject: Saving Image to Access Database
Date: Tue, 10 Oct 2006 16:05:52 +0100
Lines: 43
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962
NNTP-Posting-Host: 86.41.219.106
Message-ID: <452bb718@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1160492824 86.41.219.106 (10 Oct 2006 08:07:04 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.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