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
saifullah khan
NA
335
301.8k
Parameter is not valid.
Oct 26 2011 6:39 AM
i have stored jpeg images in database table. now i want to retrieve them. here is the code
MemoryStream stream = new MemoryStream();
try
{
cnn.Open();
cmd = new
SqlCommand("select pics from images", cnn);
byte[] image = (byte[])cmd.ExecuteScalar();
stream.Write(image, 0, image.Length);
Bitmap bitmap = new Bitmap(stream);
Response.ContentType = "image/gif";
bitmap.Save(Response.OutputStream,System.Drawing.Imaging.ImageFormat.Bmp);
}
finally
{
cnn.Close();
stream.Close();
}
but when i run the application it gives me the following error
Parameter is not valid.
Bitmap bitmap = new Bitmap(stream);
can somebody tells me what i need to correct.
Reply
Answers (
12
)
Latency modes of Garbage collection
assign Seek(0, SeekOrigin.Begin);