Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with audit table trigger
Message
 
 
To
03/03/2014 18:02:21
General information
Forum:
Microsoft SQL Server
Category:
Scripting
Environment versions
SQL Server:
SQL Server 2012
Application:
Web
Miscellaneous
Thread ID:
01595410
Message ID:
01595708
Views:
32
>>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform