我正在做类似于
...
OracleCommand oCommand = new OracleCommand();
oConnection.Open();
oCommand.Connection = oConnection;
oCommand.CommandText = "SELECT * FROM employees WHERE user = :User";
oCommand.Parameters.AddWithValue(":Name", "Employee1");
DbDataReader dbRdr = oCommand.ExecuteReader();
那么这将抛出一个异常:
ORA-01745:无效的主机/绑定变量名称
编辑:连接字符串如下:
"Data Source=orcl;Persist Security Info=True;User ID=user_id;Password=pwd;Unicode=True"
oConnection.Open();
执行后没有出现错误,因此我认为我的连接字符串是正确的。
我犯了哪些错误?