G
Guest
Hi;
I have an OdbcConnection (ADO.NET) to Sql Server (I know I can use the
SqlConnection - I'm testing our code when it uses ODBC) with:
protected DbProviderFactory provider;
protected DbCommand cmd;
....
cmd.CommandText = "select lastname from employees where (employeeid < 8)
and (lastname = @p0)";
DbParameter param = provider.CreateParameter();
param.ParameterName = "@p0";
param.Value = "thi";
cmd.Parameters.Add(param);
cmd.ExecuteReader();
And I get:
$exception {"ERROR [42000] [Microsoft][ODBC SQL Server Driver][SQL
Server]Must declare the variable '@p0'."} System.Exception
{System.Data.Odbc.OdbcException}
Any ideas? This works great for the SqlServerConnection.
--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com
Cubicle Wars - http://www.windwardreports.com/film.htm
I have an OdbcConnection (ADO.NET) to Sql Server (I know I can use the
SqlConnection - I'm testing our code when it uses ODBC) with:
protected DbProviderFactory provider;
protected DbCommand cmd;
....
cmd.CommandText = "select lastname from employees where (employeeid < 8)
and (lastname = @p0)";
DbParameter param = provider.CreateParameter();
param.ParameterName = "@p0";
param.Value = "thi";
cmd.Parameters.Add(param);
cmd.ExecuteReader();
And I get:
$exception {"ERROR [42000] [Microsoft][ODBC SQL Server Driver][SQL
Server]Must declare the variable '@p0'."} System.Exception
{System.Data.Odbc.OdbcException}
Any ideas? This works great for the SqlServerConnection.
--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com
Cubicle Wars - http://www.windwardreports.com/film.htm