The error tells me you're trying to add a SqlParameter
to the Parameters
collection of an OdbcCommand
and that won't work. Each DB provider has its own ADO.NET types. You must use the type corresponding with the provider you're using. In the case of ODBC it would be OdbcParameter
. Alternatively you can use the CreateParameter
on the command to create the parameter without regard for its type.
using (var conn = new OdbConnection(...))
{
//Must use the type corresponding to the connection
var cmd = new OdbCommand();
//Or var cmd = conn.CreateCommand();
var parm1 = new OdbcParameter();
//Or var parm1 = cmd.CreateParameter();
}
It looks like you are writing a data test. It is also possible there was a change made to the test framework you're using that prevents it from working with ODBC. It looks like you're using MSTest so make sure you are running the latest version. You may have found another bug in the implementation. You can refer to their Github Issues list to see if there are some problems with ODBC.