QTP Script for connecting to database(MS Access) in VB 6.0

This code will work only in VB 6.0
Database we are using here is MS Access.before running this script create a table in MS Acess.
In the above script i used table called "emp" and column names as "v1" and "v2".
"d:\testdata.mdb" is path of the table which we created.
Main use of this application is to use testdata of table(which is in database) in the application.


Option Explicit
Dim con,rs
Set con=createobject("adodb.connection")
Set rs=createobject("adodb.recordset")

con.provider="microsoft.jet.oledb.4.0"
con.open"d:\testdata.mdb"
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


Comments

Author: Manindra Kumar Upadhyay05 Apr 2010 Member Level: Gold   Points : 0

try this:
http://manindra.net/post/2010/04/05/VBScript-in-QTP.aspx



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: