locked
More than 1 transaction inside 1 connection, HOW??? RRS feed

  • Question

  • User1362540291 posted
    Hello There...

    I wanto to open just 1 connection and make more than 1 transactions inside this connection... how can I do it??? these transactions are some ExecuteNonQuery .

    Can some body post an example? or any URL with some tips??

    Thanks

    Patrick
    Tuesday, May 3, 2005 5:12 PM

All replies

  • User1640697700 posted

    Hi,

    you can try :

        Dim myConnection As New SqlConnection(myConnString)
        myConnection.Open()
       
        Dim myCommand1 As SqlCommand = myConnection.CreateCommand()
        Dim myCommand2 As SqlCommand = myConnection.CreateCommand()
        Dim myTrans As SqlTransaction
        Dim myTrans2 as SqlTransaction

        
        myTrans = myConnection.BeginTransaction()
        myTrans2  = myConnection.BeginTransaction()
        myCommand.Connection = myConnection
        myCommand.Transaction = myTrans

        ..............................................

         myCommand2.Connection = myConnection
        myCommand2.Transaction = myTrans2
        
       ..............................


       
        Regards



      

    Friday, May 27, 2005 3:55 PM