Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting Images ADO

Status
Not open for further replies.

spuppett

Programmer
Jan 25, 2003
48
0
0
US
I'm trying to insert an image into VFP 6.0 using ADO in VB. I don't have a clue how to go about it.

Should my field in the table be a Memo(binary) or General?

Any ideas or where to start looking would be a HUGE help,
Thanks.
 
If you are referring to adding a picture file to a table, you need to have a field of type GENERAL to hold the image. You can then use something like:
APPEND BLANK && Add a blank record
APPEND GENERAL mygenfield FROM c:\images\myimage.bmp

However, I would strongly advise against doing it that way for several reasons. First, it causes excessive file bloat. The associated .dbf's memo file can grows up to twice the size of the image file for each image added.
Second, you must have the same imaging application installed on each computer which tries to read the file, or they won't be able to open the image.
And third, it is a real chore to extract/export the image files from the table again should you decide you want to modify them.

I would recommend using a character field instead, and just referencing the image files using the full path and file name in that field.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Spuppett,

Although I agree with everything Dave said in his reply. I would add that you can't directly execute APPEND BLANK or APPEND GENERAL via ADO. You will have to use the standard SQL INSERT or UPDATE commands. Apart from that, it should work fine.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Thank you for you're replys. I really don't want to put the images in the .dbfs, but my boss asked me to check into it.

Thank you both.
 
You will also probably need to use SQL parameters as the image files won't fit nicely into strings that can be used with and insert or update command.



Regards

Griff
Keep [Smile]ing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top