10 pts.
 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: October 19, 2009  8:28 AM
UPDATED: January 23, 2010  7:21 PM

Answer Wiki:
aaaaa
Last Wiki Answer Submitted:  October 19, 2009  9:00 am  by  Azad   10 pts.
All Answer Wiki Contributors:  Azad   10 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

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.

 1,855 pts.