Skip to content

Storing and retriveal of a image

ruchir srivastava

Asked Feb 11, 2008, 10:37 PM EST2 answers
Share
LinkedInX
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.

  • 0
    VB.NET
    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 Write
    0
  • 0
    please give me full C# code for that
    0