Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C# ADO.NET (System.Data.OleDb) Transaction Scope Auto Committed Before Calling Complete() #193

Open
ras90it opened this issue Sep 4, 2023 · 1 comment

Comments

@ras90it
Copy link

ras90it commented Sep 4, 2023

`string sqlConnectionString = ""; // CONNECTION_STRING
using (TransactionScope scope = new TransactionScope())
{
try
{
using (OleDbConnection myCon = new OleDbConnection(db2ConnectionString))
{
myCon.Open();

        OleDbCommand cmd = new OleDbCommand
        {
            CommandType = CommandType.Text,
            CommandText = insertQuery, // INSERT QUERY
            Connection = myCon
        };

        _ = cmd.ExecuteNonQuery();

        scope.Complete();
    }
}
catch (Exception ex)
{
    throw;
}

}`

Reproduction Steps:-

  1. Run the C# code with the DB2 Connection String.
  2. Before Calling scoep.complete() method, the inserted value is committed in DB2 and able to be seen by querying in the DB2 table.
@ras90it ras90it changed the title C# ADO.NET Transaction Scope Auto Committed Before Calling Complete() C# ADO.NET (System.Data.OleDb) Transaction Scope Auto Committed Before Calling Complete() Sep 4, 2023
@svick
Copy link

svick commented Sep 7, 2023

This repo is not a good place for asking this kind of question. I think something like Stack Overflow has a much better chance of getting you the answer you're looking for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants