How to connect to data base?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain in brief about the qtp automation object model (aom).

564


how to test use the quality control .how to verify the image verification

2543


How to attach a file to TD?

656


What is the significance of “action 0” in qtp?

571


hi Friends ,willany body tell me what is the Scope for the automation Testing inht Future is their Or not And what is the Top Most Level in the testing section according the Pay scale

1510






If you have two monitors one is of 19inch and the 2nd one is of 24inch,if you want to write same QTP script in both the two monitors is there any changes required in the script?

1585


What is the framework your company is following. What is the reason. Explain why key word driven frame work is chosen.

1629


Hi could some one explan what is the use of the function Defination generator, And how to use the function defination generator.. Explan with the example..

1350


What is the difference between local and shared object repository in qtp?

563


What is the qtp testing process?

596


How did you use regular expressions in QTP and also in WR?

2165


What phases are involved in testing an application in qtp?

560


What is the difference between run time object and test object?

578


How to use setroproperty?

573


How to test the login page in different ways in automation testing and i need code?

1346