Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 2

DATADRIVEN TESTING (DATABASE)

ADODB CONNECTION OBJECT


1. The ADO (Activex Data Object) Connection Object is used to create an open
connection to a data source. Through this connection, you can access and
manipulate a database.
2. If you want to access a database multiple times, you should establish a
connection using the Connection object.
Set objCon = CreateObject(ADODB.Connection)
ADODB RECORDSET OBJECT
1. The ADO Recordset object is used to hold a set of records from a database table.
A Recordset object consist of records and columns (fields).
2. In ADO, this object is the most important and the one used most often to
manipulate data from a database.
3. When you first open a Recordset, the current record pointer will point to the first
record and the BOF and EOF properties are False. If there are no records, the
BOF and EOF property are True.
Set objRecordset=Server.CreateObject ("ADODB.recordset")
Note : ADODB = Activex Data Object Database

EOF

Returns true if the current record position is after the last record,
otherwise false

Move Next Moves the record pointer to the next record


Open

Opens a database element that gives you access to records in a table,


the results of a query, or to a saved Recordset

ADODB.COMMAND OBJECT:
1. By using Database Command Object, we can insert the data into the
Database in Run time.

INSERTING THE DATA INTO DATABASE TABLE USING DATABASE COMMAND


OBJECT :
Declaring the Variables
Dim objCon,objCom
Creating the Connection Object
Set objCon=Createobject("ADODB.connection")
Opening the SQL Server Data Base Details
OLEDB = Object Linking Embedded Database
objCon.open"Provider=sqloledb.1;Server=;UID=sa;PWD=;DataBase=EBanking"
Creating the Command Object
Set objCom=Createobject("ADODB.Command")
Activating the Connection Object
objCom.ActiveConnection=objCon
Inserting the Values into the Table
objCom.CommandText="insert into Emp values('KUMAR',88233,30000)"
Executing the Query to insert the Data into Table
objCom.Execute
Closing the Connection
objCon.Close
Clearing the Memory from the Data Base
Set objCom=Nothing
Set objCon=Nothing

You might also like