Hy
I want to insert into ODBC and I have the error: ERROR [42000] [Microsoft][ODBC Visual FoxPro Driver]Syntax error.
My code is:
string number;
insertStatement = "INSERT INTO " + tabela + " (Data, Fetr, Fldo, Nrdo, Dii) " +
" VALUES ( "+ "@data" +", 'cc','CD', " + number + ","+ dii + ")";
OdbcCommand cmd = new OdbcCommand(insertStatement, this.connection);
cmd.Parameters.Add("@data",OdbcType.DateTime).Value = data;
cmd.ExecuteNonQuery();
The problem is with the data, but I cannot figure out what is the problem.
Can someone help me?
Thanks
try with a ? instead of @data in the query, like this:
Msdn says:
UPDATE
you could try concatenating your date directly in the insert in this format
{ d '2011-03-10' }(see ODBC Datetime Format for reference) and drop the parameter.