我在做类似的事情
... 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: invalid host/bind variable name
编辑:连接字符串如下所示:
"Data Source=orcl;Persist Security Info=True;User ID=user_id;Password=pwd;Unicode=True"
oConnection.Open();所以我假设我的连接字符串是正确的.
我在哪一方面犯错?