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 KumarRank #459 · 5.4K reputationPosted Apr 27, 2019, 9:34 AM EDT
IsraelRank #1,223 · 1.5K reputationPosted Apr 27, 2019, 10:33 AM EDT
Amit KumarRank #459 · 5.4K reputationPosted Apr 27, 2019, 7:35 PM EDT
Jignesh KumarRank #91 · 22.9K reputationPosted Apr 27, 2019, 7:43 PM EDT
IsraelRank #1,223 · 1.5K reputationPosted Apr 28, 2019, 4:28 AM EDT
Laxmidhar SahooRank #383 · 6.6K reputationPosted Apr 28, 2019, 4:41 AM EDT
IsraelRank #1,223 · 1.5K reputationPosted Apr 30, 2019, 2:08 AM EDT
Amit KumarRank #459 · 5.4K reputationPosted Apr 30, 2019, 8:49 AM EDT