How to connect to data base?

Answers were Sorted based on User's Feedback



How to connect to data base?..

Answer / ravi

QTP supports interaction with Database using ADODB.

Set con = createobject("ADODB.Connection")
Set rs = createobject("ADODB.Recordset")

'Create DSN(DataSourceName) for your database and specify
the DSN here
'You can also establish connection using Provider name

con.open "DSN=MyDsn;UID=ravi;PWD=sample123"

con.execute "Insert into emp values(2500, 'Ravi')"

'Retrieve data from database
rs.open "select * from emp", con
while not rs.eof
msgbox "ID = " & rs(0) & " Name = " & rs(1)
rs.movenext
wend

Is This Answer Correct ?    1 Yes 0 No

How to connect to data base?..

Answer / m.s.patil

You can write OLEDB script:

Set Con =CreateObject("ADODB.Connection")
ConString="Provider:SQLNCLI;Server=plantdev;DataBase=QAServe
r;UID=patil;PWD=password1"
Con.ConnectionString=ConString
Con.Open

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More QTP Interview Questions

HOW do we find a datasheet when there are 4 datasheets in data table.this question was asked by covansys interview.

5 Answers   CTS,


How to capture the text from the application using QTP?

3 Answers  


what is option explicit? what is the use of it?

9 Answers   Syntel,


i did B.Tech cse and i secured 76%. instead of siting at home ... i would like to do some course. can u suggest me in this.

1 Answers  


I am automating a Java application. This application is developed using SWT. I am not able to get the GUI object. Even i tried with Java add-in. In tutorial it states SWT is not supported any idea. Anybody worked in such appln. My question is whether it is possible to record the GUI object of SWT appln. how it is possible.

1 Answers  






What is runtime objects and test objects? What is the difference between them?

7 Answers   IBM,


Can you tell me the differences between writing the VB script manually for a application and recording the same application in QTP , with a example?

1 Answers  


Can we do Load Teting with QTP?

12 Answers  


Hi all. Could anyone tell me the difference between an Action and a Function in QTP. Thanks in advance and Merry Christmas.

3 Answers   IBM,


can u please explain what is the exact difference between qtp8.2 and 9.0

0 Answers  


Can anyone please tell me how to select next 5th business date from calendar using QTP/UFT ?

1 Answers   Cigniti Technologies,


How do we connect QC by using QTP?

2 Answers   Infosys,


Categories