ADO vs DAO vs ADODB 
Author Message
 ADO vs DAO vs ADODB


Quote:
> When do you use ADO versus DAO versus ADODB code - just learning.  They
> must
> each have their purpose?

To clarify, there is only two in the above

        ADO
        DAO

ADODB is simply a object reference to the ADO library.

As for why two of them? Well, it much a history lesion of ms-access, and
large efforts by Microsoft to introduce new technology, but KEEP the old
technology alive and well.

ms-access is a developers tool, like VB, or C++. It allows you to write
software and develop an application. When write software, you have to decide
which data engine you are going to use. With ms-access, you can choose sql
server, oracle, or the default "file based" JET data engine.

The mdb file format is based on the JET database engine. well over 10+ years
ago, MS developed a file based dataengine called JET. In fact, Microsoft was
selling this database engine BEFORE they even had a version of sql server.
This data engine proved to be VERY popular with ms-access, and also VB
developers really liked this little engine. The API for jet is really DAO
(api = applcaiton program interace, DAO = DataActiveObejct).

So, to use the JET engine that reads/writes mdb files, you are using DAO.
This object model includes reocrdsets, and methods that allows you to
execute sql....and edit the data. The JET engine also allows you to
read/write mdb files. So popular is this data engine, that it is now
included with windows XP (so, there is zillions of copies of this data
engine). This also means that you can actually read/write mdb files on any
windows xp computer, and not have to install ms-access.

So, for the most part, developers who use ms-access are building JET based
applications, and thus tend to like using DAO. And, a large portion of the
default objects in ms-access do rely on DAO.

However, in the last 10+ years, server based database systems such as
oracle,
or sql server began to appear. So, MS created a NEW object model called ADO
(based on their activeX technology....ActivexDataObejct). The idea behind
this new ADO object was it would function VERY similar to the DAO/JET model,
but would NOT BE TIED to jet. In other words, if I am going to use sql
server, or oracle in my appcation, why load up a JET data engine that I
don't
want to use? It becomes a bit more confusing here since JET can also
connect to other database engines via ODBC. However, I think a nice new
clean object model that lets you update data..but NOT BE TIED to a
particular
database was the concept behind ADO. So, you can (presumably) writes your
database code, and later switch the database, and like you will NOT have to
change your code.

Thus, MS began to push developers to use the ADO. To be fair, the ADO object
model is cleaner, and is newer then the older DAO. Further, ADO allows in
ram
indexing, and things like disconnected reocrdsets (you grab data from the
server...close the connection).  They also cleaned up things like when
you move to the next record..it gets saved for you...where as in DAO..you
have to execute a .update.

So, if your plans are to migrate your application to sql server, or you want
LESS dependence on your jet based appcation, then you can write your
application using ADO...and ADO will connect to the DAO/JET data engine for
you. You can see now how using ADO would NOT tie you to DAO/JET..and if you
change the data engine to SQL SERVER, or oracle...your code for the most
part would work un-changed.

Since ADO only been supported in the last 3 versions of ms-access, then a
LOT of developers started out using DAO..and continue to use it...

You will find that a LOT of VB developers who find themselves working on
ms-access applications do prefer ADO..since that is what most/many of them
use.

The beauty with ms-access is that it has good full support for both object
models. The downside is often you need to clarify which object model you are
using....

So, for the most part..if you are just using ms-access and the MDB JET
engine, then DAO is fine......

--
Albert D. Kallal   (Access MVP)
Edmonton, Alberta Canada

http://www.*-*-*.com/



Wed, 06 Aug 2008 03:06:53 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. ADO Recordsets and Forms (ADO vs DAO)

2. Using ADO Recordset with Forms (ADO vs DAO)

3. DAO ADO Access vs Excel

4. ADO vs DAO

5. Basic Question DAO vs ADO

6. DAO vs ADO

7. ADO vs DAO

8. DAO vs ADO

9. ADO vs DAO

10. ADO vs DAO with recordset operations


 
Powered by phpBB® Forum Software © phpBB Group