Option Explicit
Dim con,rs
'The ADO Connection Object is used to create an open connection to a data source.
Set con=createobject("adodb.connection")
'The ADO Recordset object is used to hold a set of records from a database table.
'A Recordset object consist of records and columns (fields). When you first open a Recordset,
'the current record pointer will point to the first record and the BOF and EOF properties are False.
'If there are no records, the BOF and EOF property are True.
Set rs=createobject("adodb.recordset")
'Below it shows provider, server, username, password, database
con.open"provider=sqloledb.1;server=server2008;uid=rts_dev1;pwd=password;database=model"
'See all the parameters to recordset "Open" command - http://www.w3schools.com/ado/met_rs_open.asp
rs.open"select * from person",con
Do while not rs.eof
'will show the SECOND column values
msgbox rs.fields.Item(1)
rs.MoveNext
Loop
con.Close
Also See:
Connecting QTP to Oracle and running a Query