QTP code -Query a Database

Sponsored Links:

 Simple example of how to query an access database.

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

' count the number of records in the employee table
objRS.Open "SELECT COUNT(*) from Employee" , objDB

Msgbox "There are " & objRS.Fields(0).Value & " records in the employee table."

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

Source: http://qtphelper.com

No comments: