Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CommandBuilder vs Stored Proc for updating
Message
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01445437
Message ID:
01445477
Vues:
31
>>>
>>>Can you give us an idea of what you are trying to do? Maybe we can help..
>>
>>Say I have a dataset of one table with one row. And I need to create an UPDATE command to pass to a stored procedure. So far, in the book I am reading, I only found a way to do it by creating SQL parameter object and adding a parameter for each column that has been changed. And I don't know how to determine which columns have been change in a generic way. Does it make sense? TIA.
>
>Normally I would create an update SP that has parameters for all fields that could be updated, and pass those fields back whether they were updated or not. In general, that winds up being all fields for a table aside from the primary key.

Just one thing I wanted to add.. It is too bad that MS didn't make dataset type "accessible" in SQL Stored procedure. This way, the stored procedure could then parse the pass dataset (using FOR EACH) and create an UPDATE command dynamically. So in case you add a column to a DB table, stored procedure would not needed to be changed.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform