To retrieve the data from a database the below code will help you.
To understand the below code, it is been assumed that, the tester already knows about his database schema, tables, SQLs, Data Source Names
'Create an object for the database connection
Set objDB = CreateObject("ADODB.Connection")
'Enter the Connection string, where the Data Source Name (DSN) is pointed. Create if the DSN is not created
objDB.ConnectionString = "DSN=QT_Flight32"
'Open the DB Connection
'Prepare a SQL Statement
strSQL = "Select * from Flights where departure= 'San Francisco'"
'Execute the SQL statement and capture the results in a Results area
Set objResults = objDB.Execute(strSQL)
'Iterate until the end of results reaches
Do Until objResults.EOF
'Write the results to Report
Reporter.ReportEvent micDone, strArrival & ":" & strDeparture, ""
'Move the cursor to the next row
'Close the cursor
'Close the connection
'Destroy the objResults object
Set objResults = Nothing
'Destroy the objDB object
Set objDB = Nothing