Question DataSet Variable Length Parameter List

VentureFree

Well-known member
Joined
Jan 9, 2008
Messages
54
Programming Experience
5-10
Is it possible to include a variable length parameter list in a DataSet?

For example, I know that I can have a query with a single parameter that takes an ID for an employee and gets the data based on that. But what if I want to get info on 10, or even 15 specific employees? Is it possible to build one query that will work for both of those cases, as well as for any other number of employees? Or will I have to just get data one employee at a time, or possibly get all of the employees in one query and use Select() afterward to narrow it down?
 

demausdauth

Well-known member
Joined
Mar 24, 2008
Messages
281
Location
Minnesota
Programming Experience
3-5
Yes, you would need to create a loop to make the parameter list from some collection, but it is definitely possible.

VB.NET:
SELECT * FROM Employees WHERE EmployeeID = @Emp1 OR EmployeeID = @Emp2 OR EmployeeID = @Emp3
 
Top Bottom