ODBC Parameters with List of Values
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!
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())))
精彩评论