sql2000 - multiple update calling SP only once  
Author Message
gpap





PostPosted: Tue Apr 25 23:52:07 CDT 2006 Top

SQL Server Developer >> sql2000 - multiple update calling SP only once

ASP.NET C#, SQL Server 2000

i have a webform that contains several DB rows from a single table that
i can edit, how do i do a multiple update on these rows, ideally with a
single call to a SP

SQL Server211  
 
 
SriSamp





PostPosted: Tue Apr 25 23:52:07 CDT 2006 Top

SQL Server Developer >> sql2000 - multiple update calling SP only once You can form a batch of EXEC statements on the SP and then execute them as a
single command. For example, if you have 10 rows on your user interface, you
can loop over them and then form statements like the following (stored into
a string):
=====
EXEC sp_name <parameters>
EXEC sp_name <parameters>
EXEC sp_name <parameters>
EXEC sp_name <parameters>
EXEC sp_name <parameters>
=====
Then, you can form a command object and then feed it the above string.

Alternatively, if you are using .NET 2.0, you can use the built-in batching
features of ADO.NET 2.0
--
HTH,
SriSamp

Blog: http://blogs.sqlxml.org/srinivassampath
URL: http://www32.brinkster.com/srisamp



> ASP.NET C#, SQL Server 2000
>
> i have a webform that contains several DB rows from a single table that
> i can edit, how do i do a multiple update on these rows, ideally with a
> single call to a SP
>