The steps to connect Quick Test Pro with the Database are:
- Create a Database object, ADOB.Connection
- Set the connection string using Data Source Name (DSN)
- Open the connection to the database
- Execute the SQL query
- Close the database connection
Example:
Dim con
Set con = CreateObject(”ADODB.Connection”)
con.ConnectionString = “DSN={dsnName}” ‘###replace the dsnName
con.Open
SQL = “Select * From {tableName}” ‘###replace tableName
Set rs=con.Execute(SQL)
Do Until rs.EOF
x = rs.Fields(”{colum name}”) ‘###Replace the column name with the retrived column name of the table
msgBox(x)
rs.MoveNext
Loop
rs.Close
con.Close
Set rs = Nothing
Set con = Nothing
Comments