This article refers to the following Microsoft .NET Framework Class Library namespaces:

  • System.Data

  • System.Data.OleDb

  • System.Data.SqlClient


When you use Microsoft OLE DB Provider for SQL Server (OLEDBSQL) in ADO.NET, if you try to start more than one transaction in a session, you receive the following error message:

System.Data.OleDb.OleDbException: Cannot start more transactions on this session


By design, OLE DB Provider for SQL Server does not allow nested transactions.

More Information

Steps to Reproduce the Behavior

  1. Start Microsoft Visual Studio .NET.

  2. Create a Windows Application project in Visual Basic .NET. Form1 is created by default.

  3. Double-click Form1 to open the Code window.

  4. Replace the code in Form1 with the following code:

    Imports System.Data
    Imports System.Data.OleDb
    Imports System.Data.SqlClient

    Public Class Form1
    Inherits System.Windows.Forms.Form

    Dim cn As New OleDb.OleDbConnection()
    Dim cmd As New OleDb.OleDbCommand()
    Dim mycmd As New OleDb.OleDbCommand()

    #Region " Windows Form Designer generated code "

    Public Sub New()

    'This call is required by the Windows Form Designer.

    'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
    If disposing Then
    If Not (components Is Nothing) Then
    End If
    End If
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.Container

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
    Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
    Me.ClientSize = New System.Drawing.Size(292, 273)
    Me.Name = "Form1"
    Me.Text = "Form1"

    End Sub

    #End Region

    Private Sub Form1_Load(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles MyBase.Load
    cn.ConnectionString = "Provider=SQLOLEDB;Data Source=YourServer;" & _
    "Initial Catalog=pubs;User ID=YourUserID;Password=YourPassword"
    cmd.Connection = cn
    mycmd.Connection = cn
    cmd.CommandText = "Insert into stores (stor_id) values('9876')"
    Dim myTrans As OleDb.OleDbTransaction
    myTrans = cn.BeginTransaction(IsolationLevel.ReadCommitted)

    cmd.Transaction = myTrans


    Catch ex As Exception
    End Try

    End Sub
    End Class
  5. Modify the connection string as appropriate for your environment.

  6. Run the application. Notice that you receive the error that is listed in the "Symptoms" section.


For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

306649 PRB: Error When You Implement Nested Transaction with OLE DB Provider for SQL Provider

Need more help?

Expand your skills
Explore Training
Get new features first
Join Microsoft Insiders

Was this information helpful?

What affected your experience?

Thank you for your feedback!