Thanks ReyN. My original post wasn't very clear. What I need to do is output user-selected rows based on several multi-select listboxes.
Here is what my query looks like so far, based on input from the first multi-select listbox. Is there a way to do this without all the looping?
// Declare the query string.
String queryString = "SELECT my_ID, my_Name FROM my_tbl";
// if mylist contains at least one item
if (PreviousPage.myList.Count > 0)
{
// loop through array and add to query
foreach (int myIDInt in myArray)
{
int i = 0;
i++;
if (i == 1)
{
queryString += " AND (my_ID = @myIDInt";
}
else
{
queryString += " OR my_ID = @myIDInt";
}
if ((myArray.GetLength(0) + 1) == i)
{
queryString += ")";
}
}
}