Sunday 27 October 2013

Working with Database in QTP



ADO Object Model

-> Actvex data object
-> Enable your client application to access database.
-> Its also support while building client server and web application

RDS object model

-> Remote Data service
-> Its help to move data from server to client

RDO - Remote data object

DAO - Data access object

ADO Objects

Connection - Its hub od ADO, Provide method to allow to connect the data store.

Command - Designed to run SQL statements.

Stream - used to manipulate fields or records contain the stream of data

Recordset -


Ret


dim dnconnection

set con=CreateObject("ADODB.connection")
Set rs=CreateObject("ADODB.recordset")
   
con.open "Driver={Driver};server=MySqlServer;uid=username;pswd=password"
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