Click here to Skip to main content
15,909,091 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more: , +
Dear Friends,

I am facing a problem while running two queries on single open connection. The error is :- "Transaction cannot have multiple recordsets with this cursor type. Change the cursor type, commit the transaction, or close one of the recordsets."

my code is as follows:-
Dim mm As Object
        Dim obj As New prjMultiPath.clsMultiPath
        Dim con As New ADODB.Connection
        'Dim rs As New ADODB.Recordset
        Dim rs2 As New ADODB.Recordset
        Dim str_Renamed As String
        Dim del As String
        On Error GoTo Err_Renamed
        con.Open(obj.Connect(csid))
        con.BeginTrans()
        con.Execute("delete from gen_form16_report ")
        str_Renamed = "select TC_Empid,TC_Seqno from Gen_TaxComputationHdr where TC_Empid between '" & empfr & "' and '" & empto & "' and TC_datefrom='" & VB6.Format(datefr, "mm/dd/yyyy") & "'"
        rs2.Open(str_Renamed, con, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic)


I found one solution to this problem on this link:-



But all in vain :(. Please help me out

Thanks
Posted

1 solution

use MARS in ConnectionString. See this[^].
 
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