I have an Access DB with a table (DV1) that have [ID TIME CODE REASON] columns. I'm just trying to update the table. I keep getting a INSERT INTO sytax error. Everything I see looks fine. I've tried everything. I am opening the database, then I get the error. Any thoughts?
private void WRTODB_Click(object sender, EventArgs e)
{
OleDbConnection machStopDB = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source="+@"C:\Users\sgarner\Google Drive\Visual Studio 2012\Timer test\WRITE TO DB\WRITE TO DB\Machine_Stop.accdb");
machStopDB.Open();
string str = "INSERT INTO DV1(TIME,CODE,REASON)" +
"VALUES( ('" + DateTime.Now + "'),('" + textBox1.Text + "'),('" + textBox2.Text + "'))";
OleDbCommand insertCmd = new OleDbCommand(str, machStopDB);
insertCmd.ExecuteNonQuery();
machStopDB.Close();
}
This is just a test program I am working with.
"VALUES(Now(), " +Access will supply Now for you.