Odbc cannot use named parameters. This means that command line uses placeholders for each parameter, and this placeholder is the only question mark, not the parameter name.
OdbcCommand.Parameters
Then you need to add the parameters to the collection in the same order in which they appear on the command line
OdbcCommand cmd = conn.CreateCommand(); cmd.CommandText = "SELECT * FROM [user] WHERE id = ?"; cmd.Parameters.Add("@id", OdbcType.Int).Value = 4; OdbcDataReader reader = cmd.ExecuteReader();
You also have another problem: the word USER is a reserved keyword for MS Access Database, and if you want to use it as a field name or table name, then you need to enclose each link in square brackets. I highly recommend, if possible, changing this table name because you will encounter this problem very often.
Steve Aug 6 '13 at 14:25 2013-08-06 14:25
source share