Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QTP always returns EOF when querying SQL statement to Access 2K3
#1
Solved: 10 Years, 9 Months, 2 Weeks ago
Hi guys! I have this function there that runs a SQL query to an Access database in order to get the object configuration of a button. However, when it comes to querying the SQL statement, QTP always returns with an empty value. But, when I run the SQL statement using the native SQL compiler of Access 2003, it queries the command successfully, and returns the value that I'm searching for. Can anyone help me solve this?

Code:
    ' ==========================================
    Function AddItem(objWindow, strItem)
        On Error Resume Next

        Const adOpenForwardOnly = 0
        Const adOpenKeyset = 1
        Const adOpenDynamic = 2
        Const adOpenStatic = 3

        strTblName = Environment("Table_Name")
        curPage = objWindow.JavaButton("developer name:=BF.microflow.pageTitle").GetROProperty("attached text")

        Set connAccess = CreateObject("ADODB.Connection")
        Set rsObjects = CreateObject("ADODB.Recordset")
            connAccess.Provider = "Microsoft.JET.OLEDB.4.0"
            connAccess.Open "C:\BFTC\Object Config\BFTC_ObjConf.mdb"

        strSQLObjects = "SELECT * FROM " & strTblName & " WHERE Page='" & curPage & _
                        "' AND FieldName LIKE 'Add_" & strItem & "*' AND " & _
                        "(AttachedText LIKE 'Add*' OR AttachedText LIKE '*>*')"

        ' SELECT * FROM ROLE WHERE Page='Create Role' AND FieldName LIKE 'Add_Permission*' AND (AttachedText LIKE 'Add*' OR AttachedText LIKE '*>*')

        rsObjects.Open strSQLObjects, connAccess, adOpenStatic

        objWindow.JavaButton("attached text:=" & rsObjects.Fields("AttachedText").Value).Click

        connAccess.Close
        Set connAccess = Nothing
        Set rsObjects = Nothing

        strError = Err.Description
        AddItem = ErrorCheck(strError)
    End Function
Reply


Messages In This Thread
QTP always returns EOF when querying SQL statement to Access 2K3 - by riechan - 07-20-2012, 07:21 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Exe invoked through UFT is unable to access IIS and SQL Server service bkdevise 0 1,984 08-25-2015, 05:49 PM
Last Post: bkdevise
  This code does not give total no of links present on page plz help it returns 0 excellentpawan 8 5,299 01-17-2015, 07:49 PM
Last Post: yogi4tech
  parameterize Excel Sheet Name in SQL bjitsidhu 0 2,743 07-20-2014, 08:34 AM
Last Post: bjitsidhu
  Is there a possible way to execute sql in QTP using 'WITH' clause shruthic 0 2,996 04-26-2014, 11:42 PM
Last Post: shruthic
  How to automate MS Access Frontend application through QTP Anchal0604 0 2,297 11-26-2013, 12:40 PM
Last Post: Anchal0604

Forum Jump:


Users browsing this thread: 1 Guest(s)