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

Can anyone pls tell me in realtime (descriptive programming) how will the properties of the object be given to the test team. R they given in an excel sheet and is the same sheet also given to the development team and by whom is this given? Thanks a lot.

1566


Is the qtp course will help to create a virtual object?

1518


Explain how qtp identifies objects?

571


what kind of frame work you used in your last project?

1823


how to do the batch testing in test director using manual testing procedure?

1778






How to carry out bit map check points in QTP

1769


How would you directly trigger javascript in a test?

1473


What is the use of defining a newobject in the object repository "Define New TestOject". How to use this further. If we define new testobject, how can it recognizes the objects properties of any application.

1506


how will you check how many members visited the website www.infosys.com?

1484


can any body clearly explain about keyword driven framework .give me the explanation for files what ever you use in this frame work?

1695


when to start the automation?

1478


banking project description for software tester

7030


what is actually contain test report? can anybody post the test report

1475


What is the difference between Keyword Driven test and Data Driven test?

1775


Hi, my requirement is to make a query in SQL using QTP. And i have to get the results of that query and i have to use those results for future testing. I created a driver but i dont know the code for using this Driver. please help me by providing the solution for y requorement

1649