the difference between ADO and DAO (1 Viewer)

ajetrumpet

Banned
Local time
Yesterday, 19:12
Joined
Jun 22, 2007
Messages
5,638
what do these stand for? I just tried to change an mdb in a7 and I could not compile because my dim statements with single recordsets were not registering with the program. I had to replace all the dims with "as DAO.recordset"

it's not a big deal, but I'm wondering if I should always dim them as such instead of just dimming recordsets. what's with the difference? and what would I ever use ADO recordsets for? are they only to used for outside connections with another database?
 
And because you can use either or BOTH in the same database, you should disambiguate because they both have similar objects (recordsets for one).
 
They're both data access library that does same thing- provide a high level interface for manipulating data from a source.

At one point, Microsoft wanted to bury DAO and use ADO, and indeed, ADO was the default for a version (2000? 2002?) but later reversed the move and in fact ADO is a dead technology because it has been replaced with ADO.NET (which bears no resemblance to original ADO other than the three letters). Access can't use ADO.NET framework, but it still can use ADO.

DAO is specifically designed for JET/ACE and thus is very optimized.

Generally, I develop using 95% DAO and 5% of ADO. Where ADO really helps is when I want to use a ODBC backend's functionality that I can't use via DAO. For example suppose I want to bind my form to a stored procedure. In DAO, I could do so with a passthrough query but the form would be non-updatable. Using ADO then, could allow me to bind to the form and still edit it as if it was a plain old table (providing, of course, I continue to conform to the rules of updatability as applicable to any other forms). This is convenient if there's some kind of process that is easier to do via backend's programmability rather than within VBA/DAO.

As I may mix the libraries, it is necessary to disambiguate because both share common objects (e.g. Recordset object) which are similar but not identical (e.g. DAO recordset has FindFirst method, ADO doesn't; it only has a Find method method). Hence the need to do this:

Code:
Dim drst As DAO.Recordset
Dim arst As ADODB.Recordset

to avoid using wrong recordset object from wrong library and having the code blow up.

HTH.
 

Users who are viewing this thread

Back
Top Bottom