| Author: Gaddamchandrakanth 27 Jul 2008 | Member Level: Silver | Rating:  Points: 6 |
Hi
to retrieve the image from the database use the following code.
MemoryStream stream = new MemoryStream (); SqlConnection connection = new SqlConnection (@"server=INDIA\INDIA;database=iSense;uid=sa;pwd=india"); try { connection.Open (); SqlCommand command = new SqlCommand ("select Picture from Image", connection); byte[] image = (byte[]) command.ExecuteScalar (); stream.Write (image, 0, image.Length); Bitmap bitmap = new Bitmap (stream); Response.ContentType = "image/gif"; bitmap.Save (Response.OutputStream, ImageFormat.Gif); } finally { connection.Close (); stream.Close (); }
Thanks and Regards Chandrakanth
|
| Author: Gaddamchandrakanth 27 Jul 2008 | Member Level: Silver | Rating:  Points: 6 |
Hi
to retrieve the image from the database use the following code.
MemoryStream stream = new MemoryStream (); SqlConnection connection = new SqlConnection (@"server=INDIA\INDIA;database=iSense;uid=sa;pwd=india"); try { connection.Open (); SqlCommand command = new SqlCommand ("select Picture from Image", connection); byte[] image = (byte[]) command.ExecuteScalar (); stream.Write (image, 0, image.Length); Bitmap bitmap = new Bitmap (stream); Response.ContentType = "image/gif"; bitmap.Save (Response.OutputStream, ImageFormat.Gif); } finally { connection.Close (); stream.Close (); }
Thanks and Regards Chandrakanth
|