I have a List(Of String) that contains a number of items selected by a user from a listbox. Now, I can use the list in a select clause like this:
However, I do not know how many items the user will select from the listbox. Hence, I would like to do something like this (in pseudo code):
Does anyone have a clue how (if) this can be achieved? The only thing I can think of is to count the number of items in the list and use different select strings depending on the result, and that seems to me to be a a pretty ugly solution.
Any suggestion or idea is appreciated!
Code:
SELECT * FROM Table WHERE Field IN ('" + List.Item(0) + "', '" + List.Item(1) + "', etc...
Code:
SELECT * FROM Table WHERE Field IN (List.AnyItem)
Any suggestion or idea is appreciated!