BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Saving Image to Access Database

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder Databases (ADO)
View previous topic :: View next topic  
Author Message
Michael Corby
Guest





PostPosted: Tue Oct 10, 2006 8:05 pm    Post subject: Saving Image to Access Database Reply with quote



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
Back to top
Michael Corby
Guest





PostPosted: Wed Oct 11, 2006 10:17 pm    Post subject: Re: Saving Image to Access Database Reply with quote



Have solved this problem with help from Thomas Maeder.

Thanks, Thomas.

Michael Corby


"Michael Corby" <mcorby (AT) indigo (DOT) ie> wrote in message
news:452bb718 (AT) newsgroups (DOT) borland.com...
Quote:
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
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder Databases (ADO) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.