TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Muhammad imran
NA
16
6.6k
Images retrieval from database issue
May 15 2013 4:14 PM
Hello
i am trying to retrieve images from database.But my code is not working.Please help me.Thanks
SqlConnection conn = new SqlConnection("Data Source=localhost;Initial Catalog=company;Integrated Security=True");
conn.Open();
SqlCommand cmd = new SqlCommand("select image from image", conn);
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read()) //yup we found our image
{
Response.ContentType = dr["Image"].ToString();
Response.BinaryWrite((byte[])dr["Image"]);
Response.Write(System.Environment.NewLine);
}
Response.Close();
conn.Close();
Reply
Answers (
10
)
Popup search window
crystal report