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

1. I have asked the same question for the third time, but i am getting wrong answers. Pls give me the script to count the number of edit boxes or checkboxes in an windows application screen. In windows application childobject is not working, anyone very urgent

8 Answers  


How we can we create a Text checkpoint in QTP 9.1,Actually what i did is first i put in recording mode and gofor Inser menu>Checkpoint>Textcheckpoint>click,Now an hand symbol came and i showed it to some textbox and cliked but the QTP9.1 is giving an error message like "The Obkect you are selecting doesn't support this operation" If i go for Help of QTP 9.1 information I didn't get any solution,pls help me in this issue.

6 Answers  


What is the difference between browser sync and page sync in QTP?

2 Answers  


What are benefits of qtp?

0 Answers  


What is throw object?

0 Answers  






What is the main disadvantage of using low level and Analog modes?

2 Answers  


What is clean sweep?

0 Answers  


How many types of recording facility are available in QTP?

1 Answers  


The Senario is Steps to do 1.Entered userid in textbox 2.saved with details 3.i want to open user which i have created its in hurry.....

1 Answers  


How do u insert an object during runtime in qtp?

2 Answers  


Can we write class for vb script in Quick Test Professional?

2 Answers   JPMorgan Chase,


Can we do Load Testing with QTP?

4 Answers  


Categories