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
No comments:
Post a Comment