I am in the process of converting several queries which were hard-coded into the application and built on the fly to parameterized queries. I\'m having trouble with one part
Old question, but in case anyone comes across this via Google, here's what I use:
int status = 4;
string ids = "1,14,145,43";
m.Parameters.AddWithValue("@Status", status);
m.Parameters.AddWithValue("@IDs", ids);
UPDATE TABLE_1 SET STATUS = @Status WHERE FIND_IN_SET(ID, @IDs) > 0;
Note: FIND_IN_SET is a mySQL specific function.
Credit, where credit is due: See this question: Add List