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 u handle an object with out name in our application using QTP 9.2?

0 Answers   CTS,


how to find that a file has been completely downloaded or not? I told that "download Complete" pop up. but he told the tool doesn't recognize the pop up

1 Answers   Mphasis,


how to connect qtp to sqlserver?(if any body know about this please send mail to me:sheik_feroz5@yahoo.com)thank u

3 Answers   Honeywell,


PLEASE TELL ME WHEN DO YOU USE THE OBJECT SPY AT RUN TIME

4 Answers   Ordain Solutions,


Per-Action Vs Shared repository?

5 Answers  






1. In build1 there is a page with two check boxes and a submit button. You have prepared a script for that page and its working fine. In Build 2 the developers have added two checkboxes in the page. Will the script prepared for Build 1 work for Build 2 or not. If yes, why and if No, why. Remember the developers have not touched the object properties of the textboxes in the page.

3 Answers   ADP,


Explain the Load testing process?

1 Answers   Crea,


How QA specialist can identify when programmatic descriptions are useful?

0 Answers  


hi what is the use of "dim" in automation objective model or any where what is the use of "dim" plz tell me

3 Answers  


What is the extension of script and object repositary files?

7 Answers   Maveric,


What are Child Objects?

1 Answers  


What is the difference between two actions?

1 Answers   Wipro,


Categories