Reputation: 712
How can I delete multiple rows in a single SQL query for Oracle using Entity Framework?
"DELETE FROM WOTRANSITION WHERE woiddisplay = @id OR woid = @id"
Context.Database.ExecuteSqlCommand(
"DELETE FROM WOTRANSITION WHERE woiddisplay = @id OR woid = @id",
new[] { new SqlParameter("@id", id) });
Example code above is wrong and will return error:
Unable to cast object of type 'System.Data.SqlClient.SqlParameter' to type 'Oracle.ManagedDataAccess.Client.OracleParameter
Upvotes: 0
Views: 957
Reputation: 66501
You're trying to connect to Oracle, but you're using an SqlParameter
.
Use an OracleParameter
instead:
Context.Database.ExecuteSqlCommand(
"DELETE FROM DPCMWOTRANSITION WHERE woiddisplay = :id OR woid = :id",
new[] { new OracleParameter("id", id) });
I made a few others changes too, since I don't think the parameter names are quite correct.
Upvotes: 1