Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 992233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:13:59+00:00 2026-05-16T06:13:59+00:00

I have a n-tier C# ASP .Net application server which uses stored procedures to

  • 0

I have a n-tier C# ASP .Net application server which uses stored procedures to communicate with the database.

I have a service layer which rolls back all ADO .net transactions if an exception is thrown, using TransactionScope.requiresNew.

In my stored procedure, I want to track login attempt numbers, so we want to keep the transaction framework as is, but want to have an isolated transaction which we commit.

How do I do this?

I have tried using a new TransactionScope.RequiresNew in our data layer, but this has no effect.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T06:14:00+00:00Added an answer on May 16, 2026 at 6:14 am

    Strange – RequiresNew in the inner (Logging) TransactionScope should work.

    In the below nested transaction, TransactionScopeOption.Suppress or TransactionScopeOption.RequiresNew both work for me – the inner transaction is committed (Dal2.x), and the outer one aborted (Dal1.x).

        try
        {
            using (TransactionScope tsOuter = new TransactionScope(TransactionScopeOption.Required))
            {
                DAL1.Txn1();
                using (TransactionScope tsLogging = new TransactionScope(TransactionScopeOption.Suppress))
                {
                    DAL2.Txn2();
                    tsLogging.Complete();
                }
                throw new Exception("Big Hairy Exception");
            }
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }
    

    Edit : Mixing TransactionScope and explicit T-SQL transactions is to be avoided – this is stated in the same link you’ve referenced viz http://msdn.microsoft.com/en-us/library/ms973865.aspx, quoted below

    TransactionScopes manage transaction escalation quite intelligently – they will use the (e.g. DTC will only be used if the transactions span multiple databases or resources – e.g. SQL and MSMQ). They also work with the SQL 2005+ Lightweight transactions, so multiple connections to the same database will also be managed within a transaction without the overheads of DTC.

    IMHO the decision as to whether to use Suppress vs RequiresNew will depend on whether you need to do your auditing within a transaction at all – RequiresNew for an isolated txn, vs Suppress for none.

    When using System.Transactions,
    applications should not directly
    utilize transactional programming
    interfaces on resource managers—for
    example the T-SQL BEGIN TRANSACTION or
    COMMIT TRANSACTION verbs, or the
    MessageQueueTransaction() object in
    System.Messaging namespace, when
    dealing with MSMQ. Those mechanisms
    would bypass the distributed
    transaction management handled by
    System.Transactions, and combining the
    use of System.Transactions with these
    resource manager “internal”
    transactions will lead to inconsistent
    results …. Never mix the two

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a classic 3-tier ASP.Net 3.5 web application with forms that display business
I have a basic 3 tier app Presentation/Web (ASP.NET MVC) Application Services (WCF, hosted
I have an ASP.Net application which renders sensitive information. The application needs users to
We have a 3-tier web application written in ASP.Net Webforms where we will not
Folks, I have an ASP.NET project which is pretty n-tier, by namespace, but I
I have an N-tier application, ASP.Net front end, then a .Net C# Business and
I have an n-tier application design problem with Entity Framework 4. Server-side, my application
I have a three tier system, SQL Server backend, hand written data access layer,
I have a three-tier Windows Forms DB application in VB.NET. I'm using VS 2005.
We have an n-tier web application that pulls data from SQL Server. Our Data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.