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
Ankush
NA
267
63.5k
Retrieve Image from Sql Database using c#
Apr 6 2016 2:25 PM
I am developing a windows application using c#, where the user will save the image and retrieve the image. The image saving is working, but retrieving the image from database to picture box is not working. The code I have written was working 2 days back, but now its not working, Error occurs at runtime as "Parameter is not valid" @ line no.10 Here is my code below :-
string
cnstd = ConfigurationManager.ConnectionStrings[
"My_ConnectionString"
].ConnectionString;
SqlConnection cone =
new
SqlConnection(cnstd);
cone.Open();
string
sql =
"Select Pic from Emp_Details"
;
SqlCommand command =
new
SqlCommand(sql, cone);
byte
[] image = (
byte
[])command.ExecuteScalar();
cone.Close();
MemoryStream ms =
new
MemoryStream(image);
ms.Seek(0, SeekOrigin.Begin);
bitmap = (Bitmap)System.Drawing.Image.FromStream(ms);
pbLogo.Image = bitmap;
Thanks in Advance !!!
Reply
Answers (
3
)
Copy image from Cipboard and save in Byte[]
linq code for view cart seession