MemoryStream ms1 = new MemoryStream();
MemoryStream ms2 = new MemoryStream();
customer_pic_1.Image.Save(ms1,System.Drawing.Imaging.ImageFormat.Jpeg);
byte[] img_arr1 = new byte[ms1.Length];
ms1.Read(img_arr1,0,img_arr1.Length);
//ImageConverter converter = new ImageConverter();
//return (byte[])converter.ConvertTo(img_arr1, typeof(byte[]));
cmd.Parameters.AddWithValue("@a", name_txt.Text );
cmd.Parameters.AddWithValue("@b", designation_txt.Text);
cmd.Parameters.AddWithValue("@c", mobile_txt.Text);
cmd.Parameters.AddWithValue("@d", mail_txt.Text);
cmd.Parameters.AddWithValue("@e", image_path_txt.Text);
cmd.Parameters.AddWithValue("@f", img_arr1);
int result = cmd.ExecuteNonQuery();
if (result > 0)
{
MessageBox.Show("Ur Data Inserted Successfully....$");
}
else
{
MessageBox.Show("Sorry Ur data inserting Fail...!");
}
conx.Close();
插入图片时出现错误:
字符串或二进制数据将被截断。声明已经终止。
请帮帮我......
我试过两个,即在后端用于图像列图像varbinary我也用过.....它不工作..........