locked
ADO Recordset empty on 64bit on Office 2016 (excel) RRS feed

  • Question

  • Hi All,

    Thanks in advance.

    I am having issues with a script that I am trying to run, as you can see below one query works perfectly but the Query2 shows the error message. I ran both queries on PL/SQL  and got the correct results, could you please help me with this?

    Microsoft ActiveX Data Objects 6.1 Library

    Oracle client 18.0.0.0 64Bit

     

    =========================================================================

    Public Conn As New ADODB.Connection

    Public RS As New ADODB.Recordset

     

    UserNamePROD = "Scott"

    PasswordPROD = "tiger"

    SID = "ABCDEFDB"

     

     

    ConnParam = "Provider=OraOLEDB.oracle;" & _

                      "Data Source=" & SID & ";" & _

                      "User ID=" & UserNamePROD & ";" & _

                      "Password=" & PasswordPROD & ";"

     

     

    Conn.Open ConnParam

     

     

     

    ' TxtQuery1 Give recordset rows

    TxtQuery1 = "select 1 as A ,2 as B,3 as C from dual union select 4 as A ,5 as B,6 as C  from dual union  select 7 as A ,8 as B,9 as C  from dual"

     

     

    ' TxtQuery2  DON'T Give recordset rows and the query is corret

    TxtQuery2  = "Select * from Employees where Employess_name = 'Scott' "

     

     

    RS.Open TxtQuery1, Conn, adOpenStatic, adLockReadOnly

    'RS.Open TxtQuery2, Conn, adOpenStatic, adLockReadOnly

     

     

     RSOutput = RS.GetRows()

     

    =========================================================================

    IF  TxtQuery1 returns records

     

     

    IF TxtQuery 2 Messagge :

     

    Run-time error '3021':

     

    EitherBOFor EOF is True, or the current record has been deleted.

    Requested Operation requires a current record.

    Thursday, May 16, 2019 11:23 AM