Download presentation
Presentation is loading. Please wait.
1
ActiveX Data Objects (ADO)
Performs same functions as DAO with following improvements: Simpler command set Faster execution (sometimes) Uses less memory Consumes less disk space Supports any database to which Access can connect
2
ActiveX Data Objects (ADO)
Connection object Establishes a link to a database ADO objects should be prefixed with ADODB Set statement is optional when assigning values to ADO objects, if you use the New keyword Example: Connection property of CurrentProject stores a reference to the current database. Dim cnn As New ADODB.Connection Cnn.Open CurrentProject.Connection OR Set cnn = CurrentProject.Connection
3
ActiveX Data Objects (ADO)
Opening a recordset Arguments Table or query SQL statements may be embedded Database connection Usually the current one stored in the Connection object variable Cursor types Lock types
4
ActiveX Data Objects (ADO)
Cursor types adOpenForwardOnly Read only recordset with ability to scroll through the records in a forward direction only adOpenKeyset Requests a dynaset that can be updated adOpenDynamic Updateable, but not available for Jet databases adOpenStatic Read only where updates are not visible OpenKeyset is the type to use
5
ActiveX Data Objects (ADO)
Lock types adLockReadOnly No changes allowed adLockPessimistic Lock the record immediately upon entering adLockOptimistic Attempt to lock the record when the record is saved adLockBatchOptimistic Used for batch updating Prefer optimistic locking
6
ActiveX Data Objects (ADO)
Update method Changes saved using Update, moving to another record or closing the recordset In DAO, only Update method saves the changes Find method Replaces FindFirst, FindLast, etc. from DAO Update method in either case is highly recommended
7
ActiveX Data Objects (ADO)
Edit method ADO automatically opens in an edit mode DAO requires Edit method Both use AddNew and Delete; most other methods are similar to DAO
8
ADO or DAO? ADO is a generic interface to multiple database providers
Useful for building client/server and web applications DAO is best performer for Jet (Access) databases ADO has to retrieve info about the database before it can communicate with it ADO has security shortcomings for Jet databases ADO good for SQL server, Oracle Microsoft is not going to upgrade DAO any more. Security: When creating new users and groups programmatically, ADO does not return the personal identifier for the new user or group. If you lose the file that stores the personal identifiers, you may not be able to recreate it.
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.