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.2k
Retrieve image of greater than 1mb from sql server using c#
Feb 24 2016 12:27 AM
I want to retrieve images of greater than 1 mb in size from sql server in windpws application using c#.
When I try to insert the image of greater than 1 mb in size, it is inserted, but when I try to retrieve the image the runtime error is occurring i.e. "Parameter is not valid".
The code I tried to retrieve the image is :-
name = cbCust_Name.SelectedValue.ToString();
//btnDisplay_Click(sender, e);
SqlConnection cnn =
new
SqlConnection(conString);
MemoryStream stream =
new
MemoryStream();
cnn.Open();
SqlCommand command =
new
SqlCommand(
"Select Cust_Image from Photo where Cust_Name= '"
+ name +
"'"
, cnn);
byte
[] image = (
byte
[])command.ExecuteScalar();
stream.Write(image, 0, image.Length);
//cnn.Close();
Bitmap bitmap =
new
Bitmap(stream);
pictureBox1.Image = bitmap;
How can I retrieve the image of bigger size i.e. greater than 1 mb in size.
Thanks in Advance ...!!!
Reply
Answers (
1
)
Reports
server.transfer