I'm trying to create a DELETE
statement where I'll delete some items from a table based on a list of ids, using the IN
clause:
DELETE FROM table WHERE id IN (@ids)
Using a SqlCommand
, I'm doing the following to generate the IN
parameter:
public void DeleteItemsByIds(int[] ids) {
Parameters["ids"] = string.Join(", ", ids);
ExecuteNonQuery(deleteStatement, Parameters);
}
Then I'm getting an error:
Error converting data type varchar to bigint
Someone know how could I solve it?
Thank you all!