This is the code I use to add the values into the database:
SqlConnection con = new SqlConnection(@"Data Source=WIN-39OFKTSHQUA;Persist Security Info=True;User ID=sa;Password=asd123");
con.Open();
int id = Convert.ToInt16(textBox1.Text);
string name = textBox2.Text;
string fname = textBox3.Text;
string conc = textBox4.Text;
string mail = textBox5.Text;
string add = textBox6.Text;
int age = Convert.ToInt32 (textBox7.Text);
MemoryStream stream = new MemoryStream();
pictureBox1.Image.Save(stream, ImageFormat.Jpeg);
Byte[] imageArray = stream.ToArray();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "insert into Student values ('" + id + "','" + name + "','"+age+"','" + fname + "','" + conc + "','" + mail + "','" + add + "','"+imageArray+"')";
cmd.ExecuteNonQuery();
Now, I want to retrieve the image on another form into a picturebox. I have applied all the solutions that are available on the internet but I am unable to retrieve the image and nothing is working, every time I get an error and most of the times the error is "Parameter is not valid".
For now, I am retrieving data of the selected ids from combobox except for image, please help me.
I tried many solutions some of the recent ones are following
Loading PictureBox Image From Database
https://www.codeproject.com/Tips/465950/Why-do-I-get-a-Parameter-is-not-valid-exception-wh