How to connect database from QTP tool?

How to connect database from QTP tool. How do we use various paths using QTP.

Questions by vinodmuppiri

Showing Answers 1 - 3 of 3 Answers

IamBLAM

  • Feb 21st, 2008
 

Hi, Try this:

Set dbConObj = CreateObject("ADODB.Connection")

dbConObj.conncectionstring = "DSN=flight32"   ' (the DSn of ur Application)

dbConObj.open

'  give sql qu ery

' get the ouput   using msgbox or datatable functions

dbConObj.close

  Was this answer useful?  Yes

Option Explicit
Dim rs,con
Set con=createobject("adodb.connection")
Set rs=createobject("adodb.recordset")
con.open "provider=oraoledb.1,server=localhost;uid=scott;pwd=tiger;db=testdata
rs.open "select * from emp",con
Do while not rs.eof
vbwindow("form1").vbedit("val1").set rs.fields("v1")
vbwindow("form1").vbedit("val2").set rs.fields("v2")
vbwindow("form1").vbbutton("add").click
rs.move next
Loop

If am wrong correct me

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions