15

私は次のようなことをしています

...
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();ないので、接続文字列が正しいと思います。

どの部分で私は間違いを犯しましたか?

4

2 に答える 2