ORA-00936: missing expression when reading from database with dotConnect driver and oracle database

senzacionale picture senzacionale · Sep 6, 2011 · Viewed 7.2k times · Source

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())
                {
                    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?

Answer

CD.. picture CD.. · Sep 6, 2011

just try changing @status to :status.