Raziyeh Karimi

Raziyeh Karimi

  • NA
  • 5
  • 8.1k

how can i convart (imge) in sql to image in asp

Jun 19 2013 7:51 AM
how can i convart <Binary data>(imge) in sql to image in asp  
my code

       


while (dr.Read())


        {



            Label1.Text = dr[


"name"].ToString();



          


string image1 = Convert.ToString(DateTime.Now.ToFileTime());



          


FileStream fs1 = new FileStream(Server.MapPath("~/images/" + image1), FileMode.Create, FileAccess.Write);


          


          


byte[] bimage1 = (byte[])dr["imagestd"];


         


           fs1.Write(bimage1, 0, bimage1.Length - 1);


         


           fs1.Flush();



           Image1.ImageUrl =


"~/images/" + image1;



         


        


// Context.Response.ContentType = "image1/jpeg";



         


// Context.Response.OutputStream.Write(byteArray, 0, byteArray.Length);


          


//memoryStream.Write(byteArray, 0, byteArray.Length);


         


// Context.Response.Buffer = true;


         


// Context.Response.BinaryWrite(byteArray);



          


        }



Answers (1)