This the .NetFrame work error list
An exception of type 'System.Data.SqlClient.SqlException' occurred in Brp.Core.dll but was not handled in user code
Additional information: Implicit conversion from data type varchar to varbinary(max) is not allowed. Use the CONVERT function to run this query.
This is my model:
public byte[] Passport { get; set; }
public byte[] BusinessLogo { get; set; }
[ScaffoldColumn(false)]
public string ImageMimeType { get; set; }
[ScaffoldColumn(false)]
public string ImageMimeType2 { get; set; }
This my sequel
SqlConnection con = new SqlConnection(@"Data Source=(localdb)\v11.0;Initial Catalog=Bpr;Integrated Security=True");
SqlCommand cmd = new SqlCommand();
cmd.CommandText = String.Format("Insert into Payer(User_Id, PayerName, BusinessName,PhoneNumber,BusinessMobile,PayerAddress,NumberOfStaff,RegDate,DateOfBirth,LocationLatLog,Passport,StateOfOrigin,BusinessLogo, ImageMimeType, ImageMimeType2) values('" + payer.User_Id + "','" + payer.PayerName + "','" + payer.BusinessName + "','"
+ payer.PhoneNumber + "','"+payer.BusinessMobile + "','" + payer.PayerAddress + "','" +payer.NumberOfStaff + "','" +
payer.RegDate + "','" + payer.DateOfBirth + "','" + payer.LocationLatLog + "','" + payer.Passport + "','"
+ payer.StateOfOrigin + "','" + payer.BusinessLogo + "','" + payer.ImageMimeType + "','" + payer.ImageMimeType2+ "')");
cmd.Connection = con;
try
{
con.Open();
cmd.ExecuteNonQuery();
con.Close();
return "Success";
}
catch (Exception es)
{
throw es;
}
Thank you