Educational Materials like Computer, engineering, software and Property , Entertainment: Retrive image from database and open in new page using asp.net
Custom Search

Subscribe Now: Feed Icon

February 16, 2012

Retrive image from database and open in new page using asp.net

Retrive image from database and open in new page using asp.net

MemoryStream mstream = new MemoryStream();
SqlConnection conn = new SqlConnection("Data Source=(local)\\sqlexpress;Initial Catalog=master;Integrated Security=True");
conn.Open();
SqlCommand cmd = new SqlCommand("select Image from student1 where Id=" + TextBox1.Text, conn);
byte[] image = (byte[])cmd.ExecuteScalar();
mstream.Write(image, 0, image.Length);
Bitmap bitmap = new Bitmap(mstream);
Response.ContentType = "image/gif";
bitmap.Save(Response.OutputStream, ImageFormat.Gif);
conn.Close();
mstream.Close();
 

0 comments:

Post a Comment

Follow by Email

Video Bar

Loading...

Followers

Educational Materials like Computer, engineering, software and Property , Entertainment

Recent Visitors

Active Search Results
Wink Bingo | Slots Tips | Football manager 2010 | blackjack free | Poker Stars
Submitdomainname.com