Hi,
I have data into my DB (five records). When I search for example the number "3" its sturk and give the error message: the parameter it's not valide. Curiosly all number out of numbers inside of my DB (1,2,3,4,5) its says "Data not find".
- private void button2_Click(object sender, EventArgs e)
- {
- conn.Open();
- string sqlQuery = "select * from test where id ='" + textID.Text + "'";
- cmd = new SqlCommand(sqlQuery, conn);
- SqlDataReader DataRead = cmd.ExecuteReader();
- DataRead.Read();
- if (DataRead.HasRows)
- {
- textName.Text = DataRead[1].ToString();
- byte[] img = ((byte[])DataRead[2]);
- if (img == null)
- {
- pictureBox1.Image = null;
- }
- else
- {
- MemoryStream mstream = new MemoryStream(img);
- pictureBox1.Image = Image.FromStream(mstream); // Its sturk here on this line
- }
- }
- else
- {
- MessageBox.Show("Data not find");
- }
- conn.Close();
- }
Amit KumarPosted Apr 30, 2019, 12:49 PM
IsraelPosted Apr 30, 2019, 6:08 AM
Laxmidhar SahooPosted Apr 28, 2019, 8:41 AM
IsraelPosted Apr 28, 2019, 8:28 AM
Jignesh KumarPosted Apr 27, 2019, 11:43 PM
Amit KumarPosted Apr 27, 2019, 11:35 PM
IsraelPosted Apr 27, 2019, 2:33 PM
Amit KumarPosted Apr 27, 2019, 1:34 PM