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 7163393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:53:45+00:00 2026-05-28T13:53:45+00:00

I am using C# and MYSQL and the Rollback is not working. I have

  • 0

I am using C# and MYSQL and the Rollback is not working. I have three delete statement where the table third delete SQL don’t exists and in catch i am doing rollback but its only happening for third while

         string id = dataGridView1.Rows[index].Cells[0].Value.ToString();
         string strDelete = "DELETE FROM user WHERE id = " + id;
         OdbcTransaction transaction = null;
         OdbcCommand cmd = new OdbcCommand();
         cmd.Connection = Singleton.Instance.GetConnection();
         transaction = Singleton.Instance.GetConnection().BeginTransaction();
         cmd.Transaction = transaction;
         try
         {
             cmd.CommandText = strDelete;
             cmd.ExecuteNonQuery();
             // delete from userdata
             strDelete = "DELETE FROM userdata WHERE id = " + id;
             cmd.CommandText = strDelete;
             cmd.ExecuteNonQuery();
             // delete from usersystem
             strDelete = "DELETE FROM usersystem WHERE id = " + id;
             cmd.CommandText = strDelete;
             cmd.ExecuteNonQuery();
             // delete from user systemstatus. here table don't exists, will throw 
             // exception 
             strDelete = "DELETE FROM usersystemstatusAAAA WHERE id = " + id;
             cmd.CommandText = strDelete;
             cmd.ExecuteNonQuery();
             transaction.Commit();
         }
         catch (Exception ex)
         {
             // Attempt to roll back the transaction.
             try
             {
                 transaction.Rollback();
             }
             catch (Exception ex2)
             {
                 Console.WriteLine("  Message: {0}", ex2.Message);
             }

         }

Here the first two SQL statements are committed while suppose to rollback all.

  • 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-28T13:53:46+00:00Added an answer on May 28, 2026 at 1:53 pm

    You need to check the storage type of your MySQL database. Not all storages are transactional. For example InnoDB has transactions while MyISAM does not.

    MyISAM versus InnoDB
    MyISAM versus InnoDB

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

Sidebar

Related Questions

Using MySQL, when I have a table with (for example) three keys (one primary,
Using MySQL, I have three tables: projects : ID name 1 birthday party 2
I am using MySQL and PHP for a project I am working. I have
I am using PHP and Mysql I have PHP script in which I rollback
When using MySQL MyISAM tables, and issuing an ALTER TABLE statement to add a
Using MySQL syntax and having a table with a row like: mydate DATETIME NULL,
(Using MySQL and PHP) I have a search form that will allow my users
Note: Using MySQL 4.0, which means no subqueries (at present). I have 2 tables:
I'm using a MySQL connector in VB .Net to execute a batch of SQL
I have a MySQL table implementing a mail queue, and I use it also

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.