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

How to record application running on the Virtual machine?

636


can any body plz help by sending the qtp docs and qtp ppt's? this is my mail id:murali.padeti@gmail.com

1756


Can any one send me the QTP Basic Coding Samples?

1612


What is quicktest professional (qtp)?

565


What is debugging? How you debug your script?

606






What is the difference between run time object and test object?

574


How would you directly trigger javascript in a test?

1471


HI, pls help me on this, iam not able to capture getcelldata value in javatable... msgbox javawindow("").javatable("").getcelldata(3,3) but it diaplays empty...

2397


what is key word driven frame work ? why it is called like that ? what is the diference between keyword driven and data driven frame work ?

1548


Hi Friends... By using QTP , can we test .net products...and that product supports different languages.. thanx in advance..

4136


Discuss quicktest professional environment?

588


action contains public and private functions but do we resuable that action or not..If it is reusable How..plz tell me the ans

1626


Call to copy of an action and call to existing action… i know the diff but in real project how to use..? i want live scenario.pls help me..

1279


Can we run test with out adding object in object repository? How it is possible?

540


How can you pass value one action to another action?

553