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

Which is the best testing institute for QTP training in Hyderabad.

25 Answers   Wipro,


If u r using library files (Instead of Check Points) , How do u do bitmap check ?

0 Answers  


iam working in QTP for 2+ of exp if i attend the interview what r questions asked in perfomence testing{loadrunner} ? pls any one can say answer to this question?

0 Answers   Infosys,


What the differences are and best practical application of Object Repository?

0 Answers  


what r the drawbacks and limitations of QTP?

2 Answers   NIIT,






Can any one explain about environment variables with examples?

2 Answers  


what is a test strategy & what is the difference between test strategy & test plan?

5 Answers  


QTP WAS WORKING FINE BUT TODAY I GOT THE ERROR , THE MEMORY COULD NOT BE READ -REFERENCE MEMORY ,pPLEASE REPLY URGENT WHAT IS THE SOLUTON

1 Answers  


How to create Reusable and Multiple Actions?

0 Answers  


Hi PLZ explain User Defined Functions in QTP with eample?

2 Answers   Ordain Solutions,


Can any one brief some detail on how the shared and action object repository utilized/implemented in a real time project. I already know how to make shared object repositor by saving OR as .tsr extension..I wanted the actual concept of implementation...couple of live examples will be highly appreciated. Thanks

0 Answers  


Explain how qtp identifies object?

0 Answers  


Categories