Link to home
Start Free TrialLog in
Avatar of lankford
lankford

asked on

VB6: Moving pictures into a database.

I've got an app that uses a database.  This mdb file contains a directory that pretty much contains the path names to a bunch of images.  I am now to the point where I would like to simply embed each of these images into the mdb file itself.

How can I embed these files from code knowing only the path names leading to each file?

Lankford
Avatar of mark2150
mark2150

I'd imagine that you'ld have to use a MEMO data type and copy the image into it as a byte stream.

Only problem is that the images in the database aren't going to do you much good. You can't point to a field in a database in a LoadImage statement so if you want to *show* the images you'll have to pull the data back out of the database and recreate a file on disk as a temporary giz so you can then load the disk file back in to the picture control. This'll be slow as mud.

M
Avatar of lankford

ASKER

I've got an image control that will bind to this OLE Bindary data.  I don't have to worry about extraction, just insertion!
ASKER CERTIFIED SOLUTION
Avatar of waty
waty
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I found a much better way to do it.  Turns out that the control I am binding to the data source that displays the graphic will load the information into the database for you too. When loading the graphics, the current record then gets the binary data associated with that loaded file.  Pretty sweet and only one line of code.

I did try your code.  The image control would not read in the binary data and translate it into an image.  I do not know why and don't really have the time to find out.  

So, just to cut this short, I'll give you a C for an answer that may or may not have solved my problems.

Thank you for the reply.

Lankford