title: Parameter is not valid while retrieving image from image data type DB
body: <p>This is my code; I try to retrieve image. I try to resolve but fail:</p>
  
  <pre><code>SqlCommand cmd = new SqlCommand("select pic from pic where idimg= '" + listBox1.Text + "'", con);
  SqlDataReader r;
  
  con.Open();
  r = cmd.ExecuteReader();
  
  while (r.Read())
  {
      byte[] storedImage = (byte[])(r["pic"]);
      MemoryStream ms = new MemoryStream(storedImage);
      pictureBox1.Image = Image.FromStream(ms); // Error :Parameter is not valid
  }
  
  r.Close();
  con.Close();
  </code></pre>