Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Pass DataTable/DataSet to SQL Server - Possible?
Message
De
27/06/2005 00:30:33
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Titre:
Pass DataTable/DataSet to SQL Server - Possible?
Versions des environnements
Environment:
C# 1.1
OS:
Windows 2000 SP4
Database:
MS SQL Server
Divers
Thread ID:
01026601
Message ID:
01026601
Vues:
57
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.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform