have run into a problem with my instert satement that gives me a syntax error whenever i try and add an extra value to it.
This one works but
string sqlString1 = "INSERT INTO QuoteHeader (QuoteHeaderID, CustomerID, EmployeeID) VALUES("
+ newOrderHeader
+
",'" + custID+
"','" + empID+ "')";
add another value and I get a synax error And i'm not sure why.
string sqlString1 = "INSERT INTO QuoteHeader (QuoteHeaderID, CustomerID, EmployeeID, Month) VALUES("
+ newOrderHeader
+
",'" + custID+
"','" + empID+
"','" + textBox6.Text+
"')";
Code Snippet
try
{
new OleDbCommand(sqlString1, connectCmd); int rowsReturned = cmd.ExecuteNonQuery();cmd =
}
catch (Exception ex) [error message given here is syntax error in INSERT INTO statement]{
string s = ex.Message;
DisposeResources(
ref oleDbDataAdapter, ref ds, ref connectFill, ref connectCmd, ref cmd); return;}
Replies
Know the answer? Post it — somebody with the same question will find it here.