10 pts.
Q:
store image to sql server
would you please give me a code to store and retrieve an image in SQL Server 2000, using Visual Basic 6.0 on the front end

Software/Hardware used:
vb6
ASKED: Oct 19 2009  8:28 AM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
4255 pts.
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • Bookmark and Share
Last Answered: Oct 19 2009  12:44 AM GMT by JennyMack   4255 pts.
Latest Contributors: Azad   10 pts.
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Gent01   1840 pts.  |   Jan 23 2010  7:21PM GMT

I don’t have VB6 anymore to work out the code for you, so I’m not going to post this as the answer. Here is what you do:

Convert the image to a byte array. Add it as a parameter to the command object. Set the command object’s command test to INSERT INTO table(yourbinaryfield) VALUES(@nameyougavethebytearrayparameter)

To get it back out select and cast it to a byte array and convert it back to an image.

If you can’t figure out how to get the byte array into the command object parameters, covert it to a base64 string and store in in the database as string data.