ORA-00936: missing expression when reading from database with dotConnect driver and oracle database
I am using dotConnect driver for connecting to oracle database but i always get this error when i want to use parameters: ORA-00936: missing expression
CODE:
using (var cmd = conn.CreateCommand())
{
conn.Open();
cmd.CommandText = "SELECT stevilka_dokumenta from zmpt_dokumenti_po where status = @status"; ;
cmd.Parameters.Add("@status", OracleDbType.VarChar, "1");
using (var reader = cmd.ExecuteReader())
{
开发者_Python百科 while (reader.Read())
{
string stevilkaDokumenta = reader.GetString("stevilka_dokumenta");
}
}
Error is here:
using (var reader = cmd.ExecuteReader())
why i get ORA-00936: missing expression? How must i declare input parameters?
just try changing @status
to :status
.
Also, to those still having issues, make sure you don't include a Semicolon at the end...
精彩评论