Well I have a simple MS Access database where the connection is fine but I keep getting the error
Syntax error in INSERT INTO Statement
private void btnSave_Click(object sender, EventArgs e)
{
byte[] picbyte = System.IO.File.ReadAllBytes(imgFile);
try
{
conn = new OleDbConnection(connstring);
conn.Open();
sqlcom = new OleDbCommand("INSERT INTO Image (Img) values (@Img)", conn);
sqlcom.Parameters.AddWithValue("@Img", picbyte);
sqlcom.ExecuteNonQuery();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
conn.Close();
}
}
My table’s name is Image and the columns are ImgId (Autonumber) and Img (OLE Object)
This problem may occur if your database table contains column names that use Microsoft Jet 4.0 reserved words, can you try to change your table name?