Active X Data Objects ADO n Performs same
Active. X Data Objects (ADO) n Performs same functions as DAO with following improvements: n n n Simpler command set Faster execution (sometimes) Uses less memory Consumes less disk space Supports any database to which Access can connect
Active. X Data Objects (ADO) n Connection object n n 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: Dim cnn As New ADODB. Connection Cnn. Open Current. Project. Connection OR Set cnn = Current. Project. Connection
Active. X Data Objects (ADO) n Opening a recordset n Arguments n Table or query n n Database connection n SQL statements may be embedded Usually the current one stored in the Connection object variable Cursor types Lock types
Active. X Data Objects (ADO) n Cursor types n n ad. Open. Forward. Only n Read only recordset with ability to scroll through the records in a forward direction only ad. Open. Keyset n Requests a dynaset that can be updated ad. Open. Dynamic n Updateable, but not available for Jet databases ad. Open. Static n Read only where updates are not visible
Active. X Data Objects (ADO) n Lock types n n ad. Lock. Read. Only n No changes allowed ad. Lock. Pessimistic n Lock the record immediately upon entering ad. Lock. Optimistic n Attempt to lock the record when the record is saved ad. Lock. Batch. Optimistic n Used for batch updating
Active. X Data Objects (ADO) n Update method n n n Changes saved using Update, moving to another record or closing the recordset In DAO, only Update method saves the changes Find method n Replaces Find. First, Find. Last, etc. from DAO
Active. X Data Objects (ADO) n Edit method n n ADO automatically opens in an edit mode DAO requires Edit method
ADO or DAO? n ADO is a generic interface to multiple database providers n n DAO is best performer for Jet (Access) databases n n Useful for building client/server and web applications ADO has to retrieve info about the database before it can communicate with it ADO has security shortcomings for Jet databases
- Slides: 8