System.Data.SQLite parameterized queries with multiple values?

Posted by Rezzie on Stack Overflow See other posts from Stack Overflow or by Rezzie
Published on 2010-04-18T16:36:50Z Indexed on 2010/04/18 16:43 UTC
Read the original article Hit count: 841

Filed under:
|
|

I am trying to do run a bulk deletion using parameterized queries. Currently, I have the following code:

pendingDeletions = new SQLiteCommand(@"DELETE FROM [centres] WHERE [name] = $name", conn);

foreach (string name in selected)
    pendingDeletions.Parameters.AddWithValue("$name", centre.Name);

pendingDeletions.ExecuteNonQuery();

However, the value of the parameter seems to be overwritten each time and I end up just removing the last centre. What is the correct way to execute a parameterized query with a list of values?

© Stack Overflow or respective owner

Related posts about c#

Related posts about system.data.sqlite