Showing posts with label qtp script for connecting to databse. Show all posts
Showing posts with label qtp script for connecting to databse. Show all posts

QTP Script for connecting to database

This post will give u steps(script)to connect to database using MS Access.

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

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.

Qtp script for connecting to sql server and oracle

Related Posts Plugin for WordPress, Blogger...

Fun and Knowledge