 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Michael Corby Guest
|
Posted: Tue Oct 10, 2006 8:05 pm Post subject: Saving Image to Access Database |
|
|
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
|
Posted: Wed Oct 11, 2006 10:17 pm Post subject: Re: Saving Image to Access Database |
|
|
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 |
|
 |
|
|
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
|
|