将图像插入MSAccess数据库的异常

时间:2016-06-13 05:02:35

标签: c# ms-access

enter image description here这里我在msaccess数据库(accdb)中插入一个图像。我无法弄清楚为什么会产生这种情况。它在插入语句时说错误。

String q = @"Insert Into tblModal (ModalName, CategoryId, Gender, Type, Description, image, LastUpdated) values ('" +
                txtModalName.Text + "','" + categoryId + "','" + gender + "','"+txtType.Text +"', '" + txtDescription.Text + "',@pic, '" + DateTime.Now.ToString() + "')";

            OleDbCommand cmd = new OleDbCommand(q);
            cmd.Parameters.AddWithValue("@pic", Check.imageToByteArray(pictureBoxPhoto.Image));
            int res;
            res = br.ExecuteNonQuery(cmd);

0 个答案:

没有答案