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 

Images in Microsoft Access

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





PostPosted: Wed Oct 11, 2006 10:13 pm    Post subject: Images in Microsoft Access Reply with quote



Hi

I am loading Jpeg images to a OLE Object field in Access using
LoadFromStream in my code.

When I then examine the table in Access, the information displayed
in the field column has changed from "Package" to "Long Binary Data",
and double clicking on the column no longer displays the image, but
gives a message "A problem occurred while communicating with the
OLE Server or ActiveX control".

The following is the code for updating the Database :-


TField *field = (wDataModule->tPlants->FieldByName("JPGImage"));
TBlobField *blobField = dynamic_cast<TBlobField*>(field);
String pictureName;
TMemoryStream *stream = new TMemoryStream;

pictureName = "C:\\MC\\Images\\Tulips.jpg";
stream->LoadFromFile(pictureName);

wDataModule->tPlants->Edit();
blobField->LoadFromStream(stream);
wDataModule->tPlants->Post();

delete stream;
delete field;

Any help appreciated

Michael Corby
Back to top
Antonio Felix
Guest





PostPosted: Wed Oct 11, 2006 10:39 pm    Post subject: Re: Images in Microsoft Access Reply with quote



"Michael Corby" <mcorby (AT) indigo (DOT) ie> wrote:
Quote:
Hi

I am loading Jpeg images to a OLE Object field in Access using
LoadFromStream in my code.

When I then examine the table in Access, the information displayed
in the field column has changed from "Package" to "Long Binary Data",
and double clicking on the column no longer displays the image, but
gives a message "A problem occurred while communicating with the
OLE Server or ActiveX control".



Hi Michael,

Try to use

....
wDataModule->tPlants->Edit();
stream->Position = 0; // <-----------
blobField->LoadFromStream(stream);
wDataModule->tPlants->Post();
....


HTH
Antonio
Back to top
Michael Corby
Guest





PostPosted: Thu Oct 12, 2006 6:18 pm    Post subject: Re: Images in Microsoft Access Reply with quote



Hi Antonio

Inserting this line
Quote:
stream->Position = 0;
makes no difference to attempting to display when Access

is loaded, but I am now able to display the images
on my form, which is what I wanted.

Thanks for the help.

Michael Corby




"Antonio Felix" <nomail (AT) nm (DOT) pt> wrote in message
news:452d2c3c$1 (AT) newsgroups (DOT) borland.com...
Quote:

"Michael Corby" <mcorby (AT) indigo (DOT) ie> wrote:
Hi

I am loading Jpeg images to a OLE Object field in Access using
LoadFromStream in my code.

When I then examine the table in Access, the information displayed
in the field column has changed from "Package" to "Long Binary Data",
and double clicking on the column no longer displays the image, but
gives a message "A problem occurred while communicating with the
OLE Server or ActiveX control".



Hi Michael,

Try to use

...
wDataModule->tPlants->Edit();
stream->Position = 0; // <-----------
blobField->LoadFromStream(stream);
wDataModule->tPlants->Post();
...


HTH
Antonio
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder Databases (Desktop) 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.