Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SqlCommandBuilder class
Message
De
14/04/2014 11:14:18
 
 
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01598513
Message ID:
01598592
Vues:
32
>>>>To repeat : The Update command is constructed based on the Select command
>>>>
>>>>You're selecting everything so it's updating everything.
>>>>
>>>My point is - why does it even update PK column and why does it construct such ugly where clause?
>>
>>It updates the PK because it is in your Select command.
>>
>>>Assuming I will only change the UpdateCommand.CommandText manually, will it still work?
>>
>>Yes, but what's the point.
>>You should refine the Select command to only retrieve the fields that you want included in the Update command.
>>
>>Did you actually read the documentation?
>
>I did check it. Is there any other approach I can use? I can not change the select command, the table has lots of columns and many of them I need to make decisions. However, only a handful (about 12) I am going to really update.

Try reading again.
"To generate INSERT, UPDATE, or DELETE statements, the SqlCommandBuilder uses the SelectCommand property to retrieve a required set of metadata automatically. If you change the SelectCommand after the metadata has been retrieved, such as after the first update, you should call the RefreshSchema method to update the metadata."
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform