Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SqlCommandBuilder class
Message
 
 
À
14/04/2014 12:23:15
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:
01598610
Vues:
26
>>>>If you use select * from myTable where Pk = @Pk, will your update command include PK column?
>>>
>>>No
>>
>>Can you show your sample code - looks like I need to set up several properties for this to work the way I need.
>
>This Select command :
SqlDataAdapter da = new SqlDataAdapter("Select Id, CustId,Method FROM SCHeaders WHERE Id=23 ", conn);
generates:
>
UPDATE [SCHeaders] SET [CustId] = @p1, [Method] = @p2 WHERE (([Id] = @p3) AND ((@p4 = 1 AND [CustId] IS NULL) OR ([CustId] = @p5)) AND ((@p6 = 1 AND [Method] IS NULL) OR ([Method] = @p7)))
>
>Using 'Select *' adds more fields but still doesn't include the PK (Id)

In your case, is the ID column an identity column? If yes, then no wonder. In my case it's a numeric(17) column and not identity.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform