Code:
public void insertUsercert(byte [] cert,string Name)
{
SqlConnection conn = new SqlConnection(cons);
try
{
conn.Open();
}
catch (Exception ex)
{
MessageBox.Show("Exception" + ex.ToString());
}
SqlCommand cmd = new SqlCommand();
SqlParameter cert2 = new SqlParameter("@cert1", System.Data.SqlDbType.VarBinary, cert.Length);
cert2.Value = cert;
cmd.Parameters.Add(cert2);
cmd.CommandText = @"Update [user] Set UserCertificate=@cert1" + "where UserName='" + Name + "'"; //error at the @cert1
cmd.Connection = conn;
cmd.ExecuteNonQuery();
conn.Close();
}
}