How can I supply a List<int> to a SQL parameter?

Viewed 51075

I have a SQL statement like the following:

...
const string sql = @"UPDATE PLATYPUS
SET DUCKBILLID = :NEWDUCKBILLID
WHERE PLATYPUSID IN (:ListOfInts)";
...
ocmd.Parameters.Add("ListOfInts", ??WhatNow??);

How can I provide the comma separated list of ints, which could be any (reasonable*) number of values

  • By "reasonable" in this case I mean between one and a couple dozen.
5 Answers
Related