how we connect oracle or sql data server database to qtp.
Hi Ram I was your answer for this. Can you kindly let me
know in details steps on How we can connect to database. i
am using QTP9.2 and SQL Server Database. I am new for QTP
and this would be of great help.Thanks

Answer Posted / gms

'Declaration for SQL
Dim objConnection,objRecordset,count1

'Connecting to the database
Set objConnection = CreateObject("ADODB.Connection")

objConnection.Open "Driver={SQL Server};" & "Server=YOUR
SQL SERVER NAME;" & "Database= DB NAME;" & "UID=USERID;"
& "PWD=DB PASSWORD;"

'Running the query
sql1 = "GIVE UR QUERY HERE"
'Create record set for the query
Set objRecordset = CreateObject("ADODB.Recordset")
objRecordset.Open sql1, objConnection

As this is a Back-End process, you cannot view the result
set. so you can place the result in the datatable using the
following steps:


'Retrieving data from the database to the data table
count1 =1
While Not objRecordset.EOF
datatable.SetcurrentRow (count1)
Datatable("C",1)= objRecordset("nbr").value
objRecordset.movenext
count1 = count1+1
wend

Is This Answer Correct ?    0 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

images are dynamically changes how to compare two images with out using the bitmap

2205


To which environments does quicktest professional supports?

762


Are Shared ORs read-only?

864


What are the types of object repositories? Which one is you using?

882


How to record a qtp script ?

765


how to create flat file datasubmission in qtp

2217


What are some test assets and related extensions of qtp?

785


what is run action?

1675


Which scripting language used by quicktest professional (qtp)?

909


I want to read XML file loaded in Quality center and compare the values with the values displayed in Application (web table).How can I do that

1633


How to handle the exceptions using recovery secnario manager in quicktest professional?

896


HOw to add the recovery file at runtime to the test file .

1786


How many number of actions possible in qtp?

806


What is the purpose of loading qtp add-ins?

850


What are the check points can be inserted without recording?

829