Click to See Complete Forum and Search --> : picture in access database


Crazy D @ Work
November 10th, 1999, 03:42 AM
ok, what am I missing... I create an Access database succesfully in code. Now I need to insert pictures to the database.
The picture comes from an SQL server database.
I define the field as adLongVarBinary with a defined size of 1073741824. I use that since that's the type and defined size of an OLE Object field when I create manually with access a OLE field.
I can fill it, that works fine, but as soon as I go to Access, and double-click on the field, it tells me that Access can't communicate with the OLE server and that I have to restart that OLE server, it doesn't tell me though which/what/why...
Again, when I create it manually in Access and insert an ole object thru the insert-menu, it works fine...
Has anyone any idea what I'm supposed to do with that error? And even better, how do I get rid of it so that it works the way I (and the customer...) want?
Tnx in advance!

Crazy D @ Work :-)

Lothar Haensler
November 10th, 1999, 06:19 AM
MSDN article Q194975 has all the source code for reading and writing BLOBs to and from a jet database.

Crazy D @ Work
November 10th, 1999, 07:03 AM
It still doesn't work... I keep getting the same error, "A problem occured while MS Access was communicating with the OLE server. Close the OLE server and restart it outside of MS Access. Then try the original operation again in MS Access".
Since it does work if I use Insert Object within Access, I assume it has something to do with some sort of sign that Access knows what kind of OLE object it is. (if I insert a bitmap in Access, the field displays "Bitmap Image", when I use the code from the knowledge base, the field shows "Long binairy data")


Crazy D @ Work :-)

Lothar Haensler
November 10th, 1999, 07:19 AM
you are right, there is something special about the way access deals with OLE objects. I just can't find the %$§@! MSDN article I read a few days ago about that subject.
maybe you want to try your luck on MSDN yourself.

Crazy D @ Work
November 10th, 1999, 07:23 AM
I think I read the whole MSDN.. *LOL* ok almost :-) I can't even think of a subject to search for anymore... it drives me crazy...


Crazy D @ Work :-)

Crazy D @ Work
November 10th, 1999, 08:00 AM
Little update...
the sample code as in the mentioned knowledge base article works indeed, but, the saved picture (photo1.dat) can't be opened by any other program, and as soon as I replace that file with my picture, it doesn't work.
Also, when I try the save code on my sql server, the picture is saved succesfully, but it still doesn't work when i load it into the northwind database... so this is just a piece of &(*&#@# ... OLE sucks *LOL*


Crazy D @ Work :-)