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

  • Home
  • SEARCH
  • 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 5848727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:54:00+00:00 2026-05-22T12:54:00+00:00

Does anyone know how can I all data rollback in .net c# if one

  • 0

Does anyone know how can I all data rollback in .net c# if one of the stored proc failed during the process?

Example:

 protected void btnSave_Click(object sender, EventArgs e)
   {
      int ixTest= SaveTest("123");
      CreateTest(ixTest);

   }

   protected int SaveTest(int ixTestID)
   {
      SubSonic.StoredProcedure sp = Db.SPs.TestInsert(
         null,
         ixTestID);
      sp.Execute();
      int ixTest= (int)sp.OutputValues[0];
      return ixTest;
   }


   private long CreateTest(int ixTest)
   {
      long ixTestCustomer = CreateTestCustomer();

      TestCustomer testCustomer= new TestCustomer();
      try
      {
          testCustomer.TestCustomerId = ixTest;
          testCustomer.InteractionId = ixTestCustomer ;
          testCustomer.Save();
      }
      catch
      {
          Response.Redirect("pgCallSaveFailure.aspx");
      }

      m_saleDetail = new TestSaleDetail();
      try
      {
          m_saleDetail.SaleId = sale.SaleId;
          m_saleDetail.Save();
      }
      catch
      {
          Response.Redirect("pgCallSaveFailure.aspx");
      }

      return ixTestCustomer ;
   }

I have the following code will call to btnSave_Click, then it will call to another 2 function Savetest() and CreateTest() to save data into the database. How can I rollback all data transaction in the following code if issue only happened in CreateTest() and which Savetest() have run successfully. How can I rollback all data for both Savetest() and CreateTest()?

  • 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-22T12:54:01+00:00Added an answer on May 22, 2026 at 12:54 pm

    Use the TransactionScope class

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

Sidebar

Related Questions

does anyone know if you can get individual field comments from mysql using Zend
Does anyone know of a decent reference for synchronization issues in C++? I'm thinking
Is there an osx mysql gui, which can run a script containing multiple statements,
Converting a database of people and addresses from ALL CAPS to Title Case will
A suite of data models built on top of Qt's reflection system seems like
I am trying to measure how much data is sent and received by a
So I have a table view that contains a bunch of data. The user
So I am going through our database and removing some unneeded access levels that
I've just had a massive *blonde moment** , but it's highlighted an annoyance I
I have an Android application which handles a particular type of file. It registers

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.