Thread View: borland.public.cppbuilder.database.ado
2 messages
2 total messages
Started by Michael Corby
Tue, 10 Oct 2006 15:05
Saving Image to Access Database
Author: Michael Corby
Date: Tue, 10 Oct 2006 15:05
Date: Tue, 10 Oct 2006 15:05
41 lines
1880 bytes
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
Re: Saving Image to Access Database
Author: Michael Corby
Date: Wed, 11 Oct 2006 17:17
Date: Wed, 11 Oct 2006 17:17
51 lines
2211 bytes
2211 bytes
Have solved this problem with help from Thomas Maeder.
Thanks, Thomas.
Michael Corby
"Michael Corby" <mcorby@indigo.ie> wrote in message
news:452bb718@newsgroups.borland.com...
> 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
>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads