Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with audit table trigger
Message
 
 
À
03/03/2014 18:02:21
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Scripting
Versions des environnements
SQL Server:
SQL Server 2012
Application:
Web
Divers
Thread ID:
01595410
Message ID:
01595708
Vues:
33
>>It might work. You need to use semicolon between commands in T-SQL and I also suggest to use Add instead of AddWithValue, but the idea is this. Also, I think this should be part of the whole UPDATE command, e.g. it should be the same batch.
>
>Revise it like this?
>
>oConn.Open()
>oCommand.Text = "UPDATE myTable SET ...; DECLARE @ContextInfo varbinary(128);SELECT @ContextInfo = cast( @User AS varbinary(128) );SET CONTEXT_INFO @ContextInfo"
>oCommand.Parameters.Add("@User", SqlDbType.Char).Value = GetUser.Name 
>oCommand.ExecuteNonQuery()
>oConn.Close()
>
The UPDATE command should be last in that script.
If it's not broken, fix it until it is.


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

Click here to load this message in the networking platform