>VS.NET 2003 - relative ADO.NET newbie
>
>A "checklist" form of an ASP.NET app I'm building pulls 81 rows out of SQL Server and DataBind()s it to a CheckBoxList. The user then checks/unchecks as many of the 81 options as required.
>
>Now I need to save the results. I'm going to DELETE the original 81 rows in SQL Server, INSERT the user's new choices and also copy the same 81 records out to a history table with a datetime stamp.
>
>It would be REALLY nice to be able to pass an ADO.NET DataTable or DataSet back to a SQL Server sproc in some fashion so I can do something like
INSERT INTO CheckListTable
> SELECT ... FROM < passed (cursor)? > ...
>
>... and then do something similar to the History table as well.
SQL Server BOL says an sproc can only specify a cursor parameter as an Output parameter, not an Input parameter.
>
>As an alternative I could loop through all 81 rows in the DataTable and send them back 1 at a time via standard parameters to an sproc but calling the sproc 81 times seems dumb - somehow feeding SQL Server all the rows in 1 chunk seems a lot more elegant, if possible.
Al,
A DataSet will be easier and more efficient than individual SqlCommands. However, if you want to max out the efficiency of the code, you should consider writing a stored procedure that accepts the foreign key and a concatenated string of the 81 booleans as parameters. Then split the string and perform the updates inside of a single transaction in the stored procedure.