Click to See Complete Forum and Search --> : How will store Image in DataBase in C# windows Application


ranjeetsingh_6
July 21st, 2006, 05:25 AM
Hi

I have a pictureBox on my application. I want to store the image of picturebox in Database(Sqlserver 2000 database).My application is window application.And How i can retrive my stored picture from database also.

mcmcom
July 31st, 2006, 04:32 PM
in Sql you make a field with datatype "image" and write to it using a stream writer and a sql Connection object

i believe its as simple as getting the image in a char array, then adding that array as a parameter in a SqlCommand object.

However i recommend storing images on the IO rather than a db. Just store the link to the image in the database and write the image to a folder on the server. Thats more robust and you won't have a huge database. Putting images into a database really bloats its size.

hth,
mcm