Hi,
when saving the picture file to Access DB, like
I get this exception. why?
An UPDATE or DELETE query cannot contain a multi-valued field.Microsoft Access Database Engine
when saving the picture file to Access DB, like
fl_nm = "c:\\inetpub\\VS2012\\App17\\" + lb_ph_file2.Text;
cmd = new OleDbCommand("update ite_tab set photo_file=@image where ite_abbr=@abbr", conn);
cmd.Parameters.Add("@abbr", OleDbType.VarChar).Value = tb_iteabbr.Text.Trim();
cmd.Parameters.Add("@image", OleDbType.Binary).Value = ImageToStream(fl_nm);
if (cmd.ExecuteNonQuery() >= 1)
...
private byte[] ImageToStream(string fileName)
{
Bitmap image = new Bitmap(fileName);
MemoryStream stream = new MemoryStream();
image.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp);
return stream.ToArray();
}
I get this exception. why?
An UPDATE or DELETE query cannot contain a multi-valued field.Microsoft Access Database Engine
Many Thanks & Best Regards, Hua Min
No comments:
Post a Comment