Hello Everyone,
I've stored the images in my database and now i want to display those images in my web page and i'm using the code given below for displaying it.....
But the compiler throwing an error
<b>Invalid Parameter</b> at Bitmap bitmap =new Bitmap(stream) line
plz try to understand my code and suggest me some way to come out of this.......
MemoryStream stream = new MemoryStream ();
SqlConnection connection = new SqlConnection (@"server=.;database=kiritbhai;uid=sa;pwd=");
try
{
connection.Open ();
SqlCommand command = new SqlCommand ("Select ImageFile from Rough_Images", 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 ();
}