pass array of records from VB text box to SQL Server SP ?

bengalliboy

New member
Joined
Aug 26, 2010
Messages
1
Programming Experience
Beginner
Greetings
I am planing to pass bunch of record (with commas some thing like: Account nums:
1,2,3,4,5,6,7,8,...) and that should be passed to a SQL table or Stored Procedure.
The SQL Stored Procedure can be some thing like this: Select fields from Table where Accounts in (<all those inputs>);

What is the best way to do this in VB.net? I was also thinking if it is robust to take those account num and simply do an insert to a table and SP can do the Join. So please advise. Also post the VB code related. Thanks a lot
 
You cannot pass multiple values to a single parameter. If you want to use an sproc and you don't know how many values there will be then you'd have to pass a single string to the parameter and then have the sproc split that into a list of values. Alternatively, you can build the SQL code dynamically in your app, which would allow you to create the parameters as needed.
 
Back
Top