Thank you for Visiting my Blog

Sunday, 9 July 2017

How ADO(ActiveX Data Objects)DB connection and Recordset work

 Hi Guys!!


While connecting VBA script to any Database ADO connection object is required.

ADO :

ADO Stands for ActiveX Data Objects, is Microsoft’s Client-Server technology to access the data between Client and Server.  ADO can’t access the data source directly, it will take help of OLE DB to communicate with the data source.

The ADO Command object is used to execute a single query against a database. The query can perform actions like creating, adding, retrieving, deleting or updating records.

ADO Connection Object :

The ADO Connection Object is used to create an open connection to a data source. Through this connection, you can access and manipulate a database.

"Set connection = CreateObject("ADODB.Connection")"

'where connection is a variable


ADO Recordset object:


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).

In ADO, this object is the most important and the most used , often to manipulate data from a database.

 "Set Objectrecordset = CreateObject("ADODB.Recordset")"

'where objrecordsetis a variable


Note: Once data extracted close the objects as below.

                " Objectrecordset.Close
                connection.Close "



 Read More:
 

No comments:

Post a Comment