Surely there is a framework method that given an array of integers, strings etc converts them into a list that can be used in a SQL \"IN\" clause?
IN
e.g.
If you don't have access to the .NET 3.5 extension methods, you can do this:
StringBuilder sb = new StringBuilder(); sb.Append('('); foreach (int i in values) { sb.Append(i).Append(','); } // remove final , sb.Length -= 1; sb.Append(')'); string inValue = sb.ToString();
Which'll work on .NET 2