Interview Questions   Tutorials   Discussions   Programs   Videos   

QTP - How to connect to the Database from QTP?




303
views
asked marvit August 13, 2014 04:32 AM  

How to connect to the Database from QTP?


           

1 Answers



 
answered By Dharma   0  

QTP Scripts for connecting to MS Access:

Option Explicit

Dim con,rs

Set con=createobject("adodb.connection") 

Set rs=createobject("adodb.recordset")

con.open "Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\mydatabase.mdb;Uid=Admin;Pwd=;"

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.movenext

Loop

'Release objects'Release objects

Set rs= nothing

Set con= nothing

flag   
   add comment

Your answer

Join with account you already have

FF

Preview


Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!

Alert