Possible Duplicate:
Is it possible to send a collection of ID’s as a ADO.NET SQL parameter?
Duplicate: this is a duplicate of Is it possible to send a collection of ID’s as a ADO.NET SQL parameter? and many others. Please vote to close it and add any additional answers to one of the other duplicates.
Given an array of parameters, I want to write a SELECT/WHERE/IN statement that can handle it. I would have thought I could do something like this.
// Given List<int> listOfLanguageIDs...
string cmdText =
"SELECT StringID\n" +
"FROM TRANSLATIONTB\n" +
"WHERE LanguageID IN(@arrayOfLanguagesIDs)";
using (SqlCommand command = new SqlCommand(cmdText, ConnectionManager.Connection))
{
command.Parameters.Add( "arrayOfLanguagesIDs", SqlDbType.IntArray ).Value = listOfLanguageIDs.ToArray();
...
But alas, this does not seem to be the case, and my searching hasn't turned up anything. Am I asking the wrong questions? Or does everyone really write their own array builder/SqlDbType converter/etc?