Using: .NET 4, ODP.NET 11.2.0.3.0, Oracle Database 10g Release 10.2.0.3.0
I am going crazy in trying to determine why my delete statement doesn't work. Perhaps someone here can help me.
Here is the code that DOES work:
cmd = New OracleCommand("delete from u_parameters where pkey = :pkey and user_id = :user_id and computer is null", Con)
cmd.Parameters.Add("pkey", OracleDbType.NVarchar2).Value = "Test"
cmd.Parameters.Add("user_id", OracleDbType.Decimal).Value = 1
cmd.ExecuteNonQuery() ' -- this returns 1 as it should
Here is the code that DOESN'T work:
cmd = New OracleCommand("delete from u_parameters where pkey = :pkey and user_id = :user_id and computer = :computer", Con)
cmd.Parameters.Add("pkey", OracleDbType.NVarchar2).Value = "Test"
cmd.Parameters.Add("user_id", OracleDbType.Decimal).Value = 1
cmd.Parameters.Add("computer", OracleDbType.NVarchar2).Value = DBNull.Value
cmd.ExecuteNonQuery() ' -- this returns 0!!
By doesn't work I mean that the statement executes but nothing happens in the database (and the result of ExecuteNonQuery is 0 which means no rows where affected). I really don't understand what could be the problem here. I've tried setting the 'computer' parameter IsNullable to True but it doesn't not change anything.
Please help.