Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
YAQ on BIZ and DA tiers
Message
De
29/08/2009 23:27:03
 
 
À
29/08/2009 21:06:58
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01419401
Message ID:
01421710
Vues:
64
Well, I'm not sure what you mean in the case of MS SQL. I send data (one row of data at a time), to what I call a PUT Stored Proc and depending on the value of the PK parameter that gets passed, the SP knows to do an INSERT (if the PK is < = 0) or an UPDATE for any other PK value. OK, I make an assumption there that an invalid PK won't get passed. So, I'm not sure what you mean by a sequence of INSERT followed by UPDATE.


Bonnie, you may be interested to know (and perhaps you already know this) that with SQL 2008, you can pass an ADO.NET DataTable as a parameter to a 2008 stored proc. Basically, there's a new Table type. As I mentioned to Christof, 2008 also has a MERGE capability where you can do INSERT and UPDATE operations in a single line of code.

Also, at one point I thought this was going to come up, but it didn't, still I'll mention it anyway....starting in 2005, in an UPDATE or INSERT statement, you can OUTPUT data from the INSERTED/DELETED tables (that were previously available only in triggers). So one can insert or update, and output columns from INSERTED/DELETED (which might include new identity PKs generated) without needing another SELECT statement or another call back to the database.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform