I have set up a dataset in Visual Studio with one parameter in the Select statement. My dataset stores a list of parts which match the lot number passed into the parameter. The where clause in my dataset is as follows:
The reason I have the "in" statement is that I may pass in multple lot numbers to the query. The problem I have is that the dataset will load data if I only pass one lot number. However, if I pass more than one lot number (e.g. "lot1,lot2,lot3") it doesn't return any records. I am assuming that is because it treats the whole thing as one string and doesn't find a match.
If I change the query to the following:
and then pass in 5 lot numbers as separate parameters it works fine. My problem is that I am not going to know until runtime how many lot numbers I need to pass to the query.
Is there any way around that. I am using the DataSet to bind to a datareader control.
Mighty
Code:
where [Lot Number] IN (?)
The reason I have the "in" statement is that I may pass in multple lot numbers to the query. The problem I have is that the dataset will load data if I only pass one lot number. However, if I pass more than one lot number (e.g. "lot1,lot2,lot3") it doesn't return any records. I am assuming that is because it treats the whole thing as one string and doesn't find a match.
If I change the query to the following:
Code:
where [Lot Number] IN (?,?,?,?,?)
and then pass in 5 lot numbers as separate parameters it works fine. My problem is that I am not going to know until runtime how many lot numbers I need to pass to the query.
Is there any way around that. I am using the DataSet to bind to a datareader control.
Mighty