TransactionScopeOption.Suppress does not work

Posted on 2014-07-17
Last Modified: 2014-07-17
I have a transactionscope like this:

 using (TransactionScope tran = new TransactionScope())

                     catch (Exception ex)
                          //handle exception


In method1 I call a SP and catch any exceptions which I want to log and commit

So within the catch part of another try..catch within method1 I have the following code.

catch (Exception ex)

                        using (var scope = new TransactionScope(TransactionScopeOption.Suppress))
                            Conx.InsertLog( ex.Message, ex.StackTrace);

I understood that the second transactionscope should be unaffected by the ambient transcationscope...and when I step through the code errors are being logged. However they all seem to be rolled back by the ambient TransactionScope. What am I doing wrong??
Question by:Paulmc999
    1 Comment
    LVL 2

    Accepted Solution

    Solved problem, I was using the same DB conx in both. When I used a new connection in second transaction it worked.

    Featured Post

    PRTG Network Monitor: Intuitive Network Monitoring

    Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

    Join & Write a Comment

    I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
    The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
    Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
    Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now