I am trying to create a prepared statement in c#.
For some reason everything I try ends up with an exeption.
*. This is my code for now:
the exception i am getting is: "Operation is not valid due to the current state of the object."
using (OracleCommand cmd = new OracleCommand())
{
cmd.Connection = conn;
cmd.CommandType = CommandType.Text;
cmd.CommandText = "insert into daily_cdr_logs " +
"(message) " +
"values " +
"(:message)";
cmd.Parameters.Add(:message, msg);
//OracleDbType.Int32, postpaid_duration, ParameterDirection.Input);
cmd.Prepare();
cmd.ExecuteNonQuery();
}
- i have seen some people doing this with Parameters.AddWithValue. but for some reason i cant find the function AddWithValue in OracleCommand.Parameters, i have imported Oracle.DataAccess.Client and i have oracle DataAccess refferance, using visual studio 2010.