G
Guest
How can I setup a CLR trigger to rollback the transaction that fired the
trigger if an exception occurs.
Here is waht I'm trying to do
SQL:
INSERT INTO myTable(column1, column2)
Values(1, 2)
C# Trigger:
....
try
{
//do some processing
}
catch (SqlException ex)
{
//rollback the insert statement
}
....
I have seen code like this SqlContext.GetTransaction().Rollback however this
seems to have benn written on one of the betas because the SqlContext does
not have a GetTransaction method in the final version.
trigger if an exception occurs.
Here is waht I'm trying to do
SQL:
INSERT INTO myTable(column1, column2)
Values(1, 2)
C# Trigger:
....
try
{
//do some processing
}
catch (SqlException ex)
{
//rollback the insert statement
}
....
I have seen code like this SqlContext.GetTransaction().Rollback however this
seems to have benn written on one of the betas because the SqlContext does
not have a GetTransaction method in the final version.