title: what does implicit conversion from data type nvarchar(max) to varbinary(max) is not allowed mean and how to fix it?
body: <p>I am trying to save an image to my sql database using picturebox and save button on c# windows form application. this are the codes I used to save an image:</p>
  <pre><code>private void btnsave_Click(object sender, EventArgs e)
  {
     MemoryStream ms = new MemoryStream();
     pictureBox2.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
     Byte[] picarray = ms.ToArray();
     String picbase64 = Convert.ToBase64String(picarray);
  
     SqlConnection con = new SqlConnection(&quot;Data Source=LAPTOP-EUNPD14B;Initial Catalog=db;Integrated Security=True&quot;);
      
     SqlCommand cmd = new SqlCommand();
     con.Open();
     cmd.CommandType = CommandType.Text;
  
     cmd.CommandText = @&quot;INSERT INTO tblreport([entrynum],[reportdate],[reporttime],[vicfirstname],[viclastname],[vicmidname], [vicage],[vicgender],[vicaddress],[incident],[time],[date],[place],[casefiled],[susfirstname],[suslastname],[susmidname],[susage],[susgender],[susaddress],[suspic]) VALUES(@value1,@value2,@value3,@value4,@value5,@value6,@value7,@value8,@value9,@value10,@value11,@value12,@value13,@value14,@value15,@value16,@value17,@value18,@value19,@value20,@value21)&quot;;
  
     cmd.Parameters.AddWithValue(&quot;@value1&quot;, entryno.Text);
     cmd.Parameters.AddWithValue(&quot;@value2&quot;, dtreport.Text);
     cmd.Parameters.AddWithValue(&quot;@value3&quot;, timereport.Text);
     cmd.Parameters.AddWithValue(&quot;@value4&quot;, txtcomfirst.Text);
     cmd.Parameters.AddWithValue(&quot;@value5&quot;, txtcomlast.Text);
     cmd.Parameters.AddWithValue(&quot;@value6&quot;, txtcommid.Text);
     cmd.Parameters.AddWithValue(&quot;@value7&quot;, txtcomage.Text);
     cmd.Parameters.AddWithValue(&quot;@value8&quot;, cbocomgen.Text);
     cmd.Parameters.AddWithValue(&quot;@value9&quot;, txtcomaddress.Text);
     cmd.Parameters.AddWithValue(&quot;@value10&quot;, txtincident.Text);
     cmd.Parameters.AddWithValue(&quot;@value11&quot;, timeincident.Text);
     cmd.Parameters.AddWithValue(&quot;@value12&quot;, dtincident.Text);
     cmd.Parameters.AddWithValue(&quot;@value13&quot;, txtincidentplace.Text);
     cmd.Parameters.AddWithValue(&quot;@value14&quot;, txtcase.Text);
     cmd.Parameters.AddWithValue(&quot;@value15&quot;, susfirst.Text);
     cmd.Parameters.AddWithValue(&quot;@value16&quot;, suslast.Text);
     cmd.Parameters.AddWithValue(&quot;@value17&quot;, susmid.Text);
     cmd.Parameters.AddWithValue(&quot;@value18&quot;, susage.Text);
     cmd.Parameters.AddWithValue(&quot;@value19&quot;, cbosusgender.Text);
     cmd.Parameters.AddWithValue(&quot;@value20&quot;, susadd.Text);
     cmd.Parameters.AddWithValue(&quot;@value21&quot;, picbase64);
     cmd.Connection = con;
  
     cmd.ExecuteNonQuery();
     MessageBox.Show(&quot;Report Saved&quot;);
  
     con.Close();
  }
  </code></pre>
  <p>the codes worked when the data type that I used was Varchar but the picture won't show on the datagridview so I changed the datatype to varbinary after that I had an error.</p>
  <p>and this is the error:</p>
  <blockquote>
  <p>An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll</p>
  <p>Additional information: Implicit conversion from data type nvarchar(max) to varbinary(max) is not allowed. Use the CONVERT function to run this query.</p>
  </blockquote>
  <p><a href="https://i.stack.imgur.com/0Iiv7.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0Iiv7.jpg" alt="enter image description here" /></a></p>
  <p>Please help me! Thank you!</p>