title: retrieve image to picture box from database in c# winforms
body: <p>How to retrieve image to PictureBox in c# winforms? I tried this codes but I am having an argument exception saying that the parameter is not valid in my bitmap. </p>
  
  <pre><code>con = new SqlConnection(strConnection);
  
          MemoryStream stream = new MemoryStream();
          con.Open();
          SqlCommand command = new SqlCommand(
                    "select companyLogo from companyDetailsTbl where companyId = 1", con);
          byte[] image = (byte[])command.ExecuteScalar();
          stream.Write(image, 0, image.Length);
          con.Close();
          Bitmap bitmap = new Bitmap(stream); //This is the error
          return bitmap;
  </code></pre>