Reputation: 10813
A little outside my comfort zone...
Is there any way to pass multiple values (a list of values) to a query via ODBC Parameters in VB.Net?
For instance, is there a way to create a query along the lines of:
-- vb.net has something like Dim itemNumbers As New List(Of Integer)(SomeCount)
SELECT Cost, Description
FROM MyItemList
WHERE ItemNum IN (<my list of item numbers>)
Thanks!
Upvotes: 3
Views: 2972
Reputation: 108937
Unfortunately ODBCParameter
can hold only a single value. It might be easier to do something like this
cmd.CommandText = "SELECT Cost, Description FROM MyItemList WHERE ItemNum IN (@Items)"
cmd.Paramaters.AddWithValue("@Items", String.Join(", ", itemNumbers.Select(Function(i) i.ToString())))
Upvotes: 1