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();
-
- 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);
-
- 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 ...!!!