Microsoft로 로그인
로그인하거나 계정을 만듭니다.
안녕하세요.
다른 계정을 선택합니다.
계정이 여러 개 있음
로그인할 계정을 선택합니다.

이 문서에서는 다음 Microsoft .NET Framework 클래스 라이브러리 네임스페이스를 참조합니다.

  • System.Data

  • System.Data.OleDb

  • System.Data.SqlClient

증상

Microsoft OLE DB 공급자를 SQL Server(OLEDBSQL)ADO.NET 세션에서 두 개 이상의 트랜잭션을 시작하려고 하는 경우 다음 오류 메시지가 표시됩니다.

System.Data.OleDb.OleDbException: 이 세션에서 더 많은 트랜잭션을 시작할 수 없습니다.

원인

설계상 OLE DB 공급자는 SQL Server 중첩된 트랜잭션을 허용하지 않습니다.

추가 정보

동작을 재현하는 단계

  1. .NET Microsoft Visual Studio 시작합니다.

  2. .NET에서 Windows 애플리케이션 프로젝트를 Visual Basic. Form1은 기본적으로 만들어집니다.

  3. Form1을 두 번 클릭하여 코드 창을 니다.

  4. Form1의 코드를 다음 코드로 바 대체합니다.

    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()
    MyBase.New()

    'This call is required by the Windows Form Designer.
    InitializeComponent()

    '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
    components.Dispose()
    End If
    End If
    MyBase.Dispose(disposing)
    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()
    '
    'Form1
    '
    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"
    cn.Open()
    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

    Try
    cmd.ExecuteNonQuery()

    myTrans.Begin()
    myTrans.Commit()
    Catch ex As Exception
    MessageBox.Show(ex.ToString)
    End Try

    End Sub
    End Class
  5. 환경에 적합한 연결 문자열을 수정합니다.

  6. 애플리케이션을 실행합니다. "증상" 섹션에 나열된 오류가 표시됩니다.

참조

자세한 내용은 아래 문서 번호를 클릭하여 Microsoft 기술 자료에서 문서를 볼 수 있습니다.

306649 PRB: OLE DB 공급자를 통해 중첩된 트랜잭션을 구현할 때 오류 SQL 공급자

도움이 더 필요하세요?

더 많은 옵션을 원하세요?

구독 혜택을 살펴보고, 교육 과정을 찾아보고, 디바이스를 보호하는 방법 등을 알아봅니다.

커뮤니티를 통해 질문하고 답변하고, 피드백을 제공하고, 풍부한 지식을 갖춘 전문가의 의견을 들을 수 있습니다.

이 정보가 유용한가요?

언어 품질에 얼마나 만족하시나요?
사용 경험에 어떠한 영향을 주었나요?
제출을 누르면 피드백이 Microsoft 제품과 서비스를 개선하는 데 사용됩니다. IT 관리자는 이 데이터를 수집할 수 있습니다. 개인정보처리방침

의견 주셔서 감사합니다!

×