Dear sir,
I want to store data into database through insert query but i facing error
'
Implicit conversion from data type varchar to varbinary(max) is not allowed. Use the CONVERT function to run this query.'
Filedata(column Name) Varbinary(Max) datatype
My code are following:-
SqlCommand cmd = new SqlCommand("INSERT INTO CompRecd(ComNo, ComCat, ComSubCat, Whom, City, MobNo, PhoNo, EmailID, FileData,TimeStamp, officer, HouseNo, [from], CompSubCat2, Locality ,FileDataType, Complaint , ipaddress) VALUES('" + compid + "','" + ds.Tables[0].Rows[0]["ComCat"].ToString() + "', '" + ds.Tables[0].Rows[0]["ComSubCat"].ToString() + "','" + ds.Tables[0].Rows[0]["Whom"].ToString() + "','" + ds.Tables[0].Rows[0]["City"].ToString() + "', '" + ds.Tables[0].Rows[0]["MobNo"].ToString() + "','" + ds.Tables[0].Rows[0]["PhoNo"].ToString() + "','" + ds.Tables[0].Rows[0]["EmailID"].ToString() + "','" + ds.Tables[0].Rows[0]["FileData"].ToString() + "', getdate(),'" + item.Value + "','" + ds.Tables[0].Rows[0]["HouseNo"].ToString() + "', '" + ds.Tables[0].Rows[0]["from"].ToString() + "','" + ds.Tables[0].Rows[0]["CompSubCat2"].ToString() + "','" + ds.Tables[0].Rows[0]["Locality"].ToString() + "','" + ds.Tables[0].Rows[0]["FileDataType"].ToString() + "','" + ds.Tables[0].Rows[0]["Complaint"].ToString() + "','" + ds.Tables[0].Rows[0]["ipaddress"].ToString() + "')", cnn);
What I have tried:
I want to store data into database through insert query but i facing error
'
Implicit conversion from data type varchar to varbinary(max) is not allowed. Use the CONVERT function to run this query.'