the problem.
MyConx.CreateCommand OdbcCommand cmd = ();
cmd.CommandText = "INSERT INTO myTable (field1, field2, field3) VALUES (@ field1, @ field2, @ field3)";
cmd.Parameters.AddWithValue ("@ field1", "value field 1");
cmd.Parameters.AddWithValue ("@ field2", 2);
cmd.Parameters.AddWithValue ("@ field3", DateTime.Now);
cmd.ExecuteNonQuery ();
error.
ERROR [07002] [Microsoft] [ODBC Microsoft Access Driver] A few parameters. Expected 3.
My response.
happens? And add the three parameters! Because. Net does not like me?
The Solution.
MyConx.CreateCommand OdbcCommand cmd = ();
cmd.CommandText = "INSERT INTO myTable (field1, field2, field3) VALUES (?,", ")";
cmd.Parameters.AddWithValue ("@ field1", "value field 1");
cmd.Parameters.AddWithValue ("@ field2" 2);
cmd.Parameters.AddWithValue ("@ field3", DateTime.Now);
cmd.ExecuteNonQuery ();
reason.
Access does not support named parameters with @
I leave this post a bit short but concise.
Greetings Dear Readers!
0 comments:
Post a Comment