Skip to content
This repository was archived by the owner on Jun 17, 2024. It is now read-only.
This repository was archived by the owner on Jun 17, 2024. It is now read-only.

C# ADO.NET (IBM.Data.DB2.Core) Transaction Scope Auto Committed Before Calling Complete()  #45

@ras90it

Description

@ras90it

string db2ConnectionString = "";
string insertQuery = ""; // INSERT QUERY

using (TransactionScope scope = new TransactionScope())
{
try
{

    using (DB2Connection myCon = new DB2Connection(db2ConnectionString))
    {
        myCon.Open();

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

        _ = cmd.ExecuteNonQuery();

    }
}
catch (Exception ex)
{
    throw;
}

}

Reproduction Steps:-

  1. Run the C# code with the DB2 Connection String.
  2. Before Calling scope.complete() method, the inserted value is committed in DB2 and able to be seen by querying in the DB2 table.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions