0% found this document useful (0 votes)
37 views

Program To Connect SQL-Server From QTP: Con - Open"provider Sqloledb.1 Server Mindq9 Uid Sa PWD Database Satish"

The document provides code samples to connect to SQL Server and Microsoft Access databases from QTP and retrieve data using ADO recordsets. It shows how to open connections to the databases using the appropriate providers, execute a SQL query to retrieve all records from a table, and loop through the recordset to display field values. Additional information is given on recordset properties like EOF and BOF that indicate record position.

Uploaded by

harikaparimala06
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views

Program To Connect SQL-Server From QTP: Con - Open"provider Sqloledb.1 Server Mindq9 Uid Sa PWD Database Satish"

The document provides code samples to connect to SQL Server and Microsoft Access databases from QTP and retrieve data using ADO recordsets. It shows how to open connections to the databases using the appropriate providers, execute a SQL query to retrieve all records from a table, and loop through the recordset to display field values. Additional information is given on recordset properties like EOF and BOF that indicate record position.

Uploaded by

harikaparimala06
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

Program to Connect SQL-Server From QTP set con=createobject("Adodb.connection") set rec=createobject("Adodb.

recordset")
con.open"provider=sqloledb.1;server=mindq9;uid=sa;pwd=;database=satish"

rec.open"select * from emp",con While rec.EOF <> true Empno=rec(0) Empname=rec(1) msgbox Empno msgbox Empname rec.MoveNext Wend Set con = nothing Set rec = nothing --------------------------------------------------EOF return True when the Rec Pointer Present at Ending Of File. BOF return True when the Rec Pointer Present at 1 St Rec . --------------------------------------------------Provider Names For Different Data Bases.

Data Base SQL Server Ms-Access Oracle

Provider Names
sqloledb.1 or SQL Server

Microsoft.Jet.oledb.4.0 MsdaOra or Oraoledb.1

--------------------------------------------------Program to Connect MS-Access From QTP set con=createobject("Adodb.connection") con.Provider="Microsoft.Jet.oledb.4.0" con.Open "d:\testdata.mdb" set rec=createobject("Adodb.recordset") rec.open"select * from emp",con While rec.EOF <> true Empno=rec(0) Empname=rec(1) msgbox Empno msgbox Empname rec.MoveNext

Wend Set con = nothing Set rec = nothing

You might also like