implicit conversion (varchar to varbinary) not allowed, use the CONVERT

0

I'm trying to make a system that gets images and saved them in a specific database, but I can not solve this error (I already applied CONVERT in SQL but it did not solve). (Error Area)

//Aqui vai entrar a gravação do db
SqlConnection conect = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\Database1.mdf;Integrated Security=True");
    SqlCommand comm = null;
    string strSQL;
    string baseimage;
    conect.Open();
    method = converter(imagensPictureBox.Image);
    strSQL = "INSERT INTO dbo.[Dados principais](Denuncias, [Denuncia ID], Empresa, Data, Denunciado,Imagens)VALUES('" + denunciasTextBox.Text + "', '" + denuncia_IDTextBox.Text + "', '" + empresaComboBox.Text + "', '" + dataDateTimePicker.Value.ToString() + "', '" + denunciadoTextBox.Text + "','" + methodToaBase64String + "')";
    comm = new SqlCommand(strSQL, conect);
    comm.ExecuteNonQuery();
    conect.Close();
    MessageBox.Show("Denúncia arquivada");
}
catch (Exception xx)
{
    MessageBox.Show("Erro detectado" + xx.Message);
}       
// Aqui fecha a db.

Convert is a function that passes the image to Byte [].             I am allocating the data in a varbinary column.

    
asked by anonymous 22.01.2018 / 10:56

0 answers