title: The conversion is not supported. [ Type to convert from (if known) = nvarchar, Type to convert to (if known) = image ]
body: <p>i have one windows form . in that form when i update an image it show me this message :
  "The conversion is not supported. [ Type to convert from (if known) = nvarchar, Type to convert to (if known) = image ]"..in database the datatype is image..</p>
  
  <p>this is my code :
  please give me a solution...</p>
  
  <pre><code>                ms = new MemoryStream();
                  pictureBox1.Image.Save(ms, ImageFormat.Jpeg);
                  photo_aray = new byte[ms.Length];
                  ms.Position = 0;
                  ms.Read(photo_aray, 0, photo_aray.Length);
  
  
  
                  cmd = new SqlCeCommand("update register set name='" + textBox1.Text + "' ,address='" + textBox2.Text + "',mobile='" + textBox3.Text + "',gender='" + a + "',dob='" + textBox4.Text + "' ,photo='"+byteArrayToImage(photo_aray)+"',worktype='" + comboBox2.SelectedItem + "',workertype='" + comboBox1.SelectedItem + "',dor='" + textBox5.Text+ "' where name='" + comboBox3.SelectedItem.ToString() + "'", con);
                  cmd.ExecuteNonQuery();
  
  
  
  
      //convert bytearray to image...
      public Image byteArrayToImage(byte[] byteArrayIn)
      {
          MemoryStream ms = new MemoryStream(byteArrayIn);
          Image returnImage = Image.FromStream(ms);
          return returnImage;
      }
  </code></pre>