Click here to Skip to main content
15,889,266 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am using sql server 2000 and my project is developed in vb6. and I am used ADODB connection. And My data is saved successfully and my project is running last 3 years without any error. But now, sometimes shown a error message during data save.
error message :
cannot start more transactions on this session
So could anybody help me why occurred this error.
My code sample is like
VB
Db_SQL.BeginTrans
If Len(lblSerialNo.Caption) > 1 Then
       Db_SQL.Execute strSql   ''excute a store-procedure for insert data into mastertable
   
     For i = 1 To dataGrid.rows - 1
            Db_SQL.Execute strSql  ''excute a store-procedure for insert data into detailstable
     Next    
     Db_SQL.CommitTrans
  Else
        Dim adorstTemp As New ADODB.Recordset
        adorstTemp.CursorLocation = adUseClient
        adorstTemp.Open "select Slno from tblSLno",Db_SQL, adOpenStatic, adLockOptimistic, adCmdText
        mlngServiceSlno = CLng(adorstTemp("Slno ")) + 1
     Db_SQL.Execute strSql   ''Update data by StoreProcedure
     
      For i = 1 To dataGrid.rows - 1
            Db_SQL.Execute strSql  ''excute a store-procedure for insert data into detailstable
      Next    
     If Condition true then
       Db_SQL.Execute strSql
     end if 
        adorstTemp("Slno") = mlngServiceSlno
        adorstTemp.Update
        adorstTemp.Close
      
        Db_SQL.CommitTrans
  End if

Have any problem this code
Posted
Updated 12-Dec-10 21:51pm
v4
Comments
Abdul Quader Mamun 13-Dec-10 3:51am    
Spelling check.

1 solution

Somehow, your code is trying to nest a transaction inside another transaction. This is usually caused because you haven't called either .CommitTrans or .RollbackTrans on the transaction you already started, before you tried to start another transaction.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900