Storing and retriveal of a image
how can i store a image and retrieve that image in sql2003 in c#.Net code
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Tal Giladi3 pointsPosted Feb 12, 2008, 10:08 AM EST
for storing you need to use parameterized sql command - meaning you'll add the image bytes as an sql parameter (assuming you have a table with a column defined as image): SqlCommand com = new SqlCommand("insert into mytable (myimage) values(@myimage"); com.Parameters.Add(new SqlParameter("@myimage", myImageBytes)); for retrieving, well, just get the byte array from the database and use the Bitmap class to read bytes to image again, or just send the bytes with the Page Response Binary Writeruchir srivastava6 pointsPosted Feb 12, 2008, 7:49 PM EST