Tech
Forums
Jobs
Books
Events
Videos
Conference
Annual Conference
Bcrypt
Ai Conference
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
1
Answer
Retrieve image of greater than 1mb from sql server using c#
Ask a question
Ask a question
Upload Source Code:
Select only zip and rar file.
Ankush
8y
369
1
Reply
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 ...!!!
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
Reports
server.transfer