Link to home
Start Free TrialLog in
Avatar of TrialUser
TrialUserFlag for Afghanistan

asked on

looping through record set in sql server stored procedure from VS application

I have a datatable created in windows VB.net application. I need to loop through the rows in the datatable and update rows in two different tables.
One way I can do this is in VB.net I can loop through the datatable and make 2 separate calls to update the two different table for each row in the datatable. Which means if I have 10 rows in the datatable then I will make 20 database calls.
I am wondering what would be the most efficient way to handle this in terms of speed.
Should I be passing a datatable to a stored procedure, loop through the record set in SQL side and do the updates to two tables in this stored procedure.

Please suggest. Thanks




ASKER CERTIFIED SOLUTION
Avatar of Lowfatspread
Lowfatspread
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I should have been more specific with my code.. That logic is a loop that will insert data.. But the logic has to be in a stored procedure.. Let me know if I can help you with more logic..:)