Micro Focus QTP (UFT) Forums
MDB result to compare against QTP Output - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: MDB result to compare against QTP Output (/Thread-MDB-result-to-compare-against-QTP-Output)



MDB result to compare against QTP Output - sriqa2009 - 03-01-2010

Hi, i am pretty much new to QTP .. and even VbScripting .. can you help me on the below!

The below code only retrieves the first value in the first row, In what way can i retrieve data in sequence (one row after the other) from a table, in access database and compare against an output value ( from a Webedit object on the GUI ) for different employees.

Here is a sample of the code

Code:
dim objDB
dim objRS
dim intCounter

' create a database and recordset objects
Set objDB = CreateObject("ADODB.Connection")
Set objRS = CreateObject("ADODB.RecordSet")

' configure the connection
objDB.Provider="Microsoft.Jet.OLEDB.4.0"
objDB.Open "c:\MyTestDatabase.mdb"

' count the number of records in the employee table
objRS.Open "SELECT emp from Employee" , objDB

' HOW DO I loop and GET DATA IN A SEQUENCE ONE AFTER THE OTHER AND COMPARE AGAINST MY OUTPUT VALUE IN QTP

' destroy the objects
Set objDB = Nothing
Set objRS = Nothing


RE: MDB result to compare against QTP Output - Saket - 03-02-2010

try below to loop through your recordset
Code:
objRS.MoveFirst
While Not objRS.EOF
    Val = objRS.Fields("emp")
    objRS.MoveNext
Wend



RE: MDB result to compare against QTP Output - sriqa2009 - 03-04-2010

Thanks Saket.. Can you tell me .. how to use it in the above code

.. i think, i am doing something wrong.


RE: MDB result to compare against QTP Output - Saket - 03-05-2010

append these lines to your code, before setting objects to nothing.
try and let me know how it goes.