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

Where is the resultset of a sqlquery (which is fired by rsobj.open sqlquery,xxxx,xxxx) stored ?

2110


I recorded a Web App with a Oracle backend using QTP 9.5 and for some reason the scripts don't play back> What am I missing at this point. I recorded the same Apps under Sybase and they work great. This is Oracle 10g. Why won't my scripts play back.

1761


hi in real time who will execute the qtp test scripts? my faculty said, in a companty automation testers are written the test scripts and manual testers are execute the test scripts...IS IT RIGHT OR NOT?

3217


your coming from electrical backgroung..but y ur coming to software side?

1565


Have you done batch testing in qtp? If yes how you are doing?

698


What is reusable action?

790


what is the difference btn risks & Therads in the Test plan documentation?

1855


In qtp, explain what is keyword driven automation framework?

821


What are the main differences of qtp and win runner?

819


How do you create regression test packs?

853


How can you identify the browser and its information using the qtp script?

777


Where to use function or action?

859


How many types of recording modes in qtp? Describe each type with an example where we use them?

812


How to export quicktest professional (qtp) results to an .xls file?

813


what are the mandatory properties for a tex boxc (scenario?)

1749