المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Batch update in SQL Server Database



C# Programming
01-22-2010, 09:50 AM
Hello all,
I have a windows application which updates multiple rows (using a stored procedure in the db) in a SQL Server database, but this updates run many times sequentially in a for loop.
For the update methos I have tried the following methods:
- The SqlCommand object running my stored procedure as a text commnand and executing it with the ExecuteNonQuery method.
- An SqlDataAdapter using its UpdateCommand attribute and executing using the ExecuteNonQuery method.

In both ways the running time is really slow.
Can anyone suggest me an other way to do the updates. It would be good if I could save my updates n a dataset or a datatable and after save it to the db.

Thanks in Advance

Dimitris