?
Solved

ADO and DAO

Posted on 2003-03-29
25
Medium Priority
?
5,519 Views
Last Modified: 2013-11-23
What are the differences between DAO and ADO?
0
Comment
Question by:puthuvin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
  • 2
  • +8
25 Comments
 

Author Comment

by:puthuvin
ID: 8233058
Please send the answer of this question immediately.
0
 
LVL 12

Accepted Solution

by:
jyokum earned 2000 total points
ID: 8233147
0
 
LVL 12

Expert Comment

by:jyokum
ID: 8233152
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Expert Comment

by:yronnen
ID: 8233204
DAO is obsolete. It is not being developed since 1998 or so, it was replaced by ADO. Don't use DAO.

0
 
LVL 4

Expert Comment

by:davidmwilliams
ID: 8233280
ADO is more lightweight and supports many "non-database" data sources like e-mail.

Further, ADO is optimised for disconnected data sets.
0
 
LVL 27

Expert Comment

by:Dabas
ID: 8233540
Historically, DAO has existed since Microsoft allowed programming languages like VB to have MS Access data abilities. (I think that started with VB4)

DAO stands for Data Access Objects and although it can be used for several non MS Access Databases, it is nearly alwasy used for Access only. In short, it is the native way of working with an MS Access Database.

Between DAO and ADO, Microsoft introduced RDO, which stands for Remote Data Objects. The objective was to introduce a Database interface that was not mainly MS Access based, but that would be easy to use with other Databases, such as the emerging SQL Server.

ADO, standing for Activex Data Objects is the current way of doing things (unless you want to talk about ADO.NET which is not necessarily the same, and is even more "modern").

As one of the previous experts has mentioned, if you have the choice, ADO should be the way to go, for various reasons, one of the main ones being scalability. Maybe today your database is in MS Access. If in the future you would like to scale the whole application upwards, say to SQL Server or Oracle or other database, chances are that if you use DAO you will need to rewrite quite a lot of your code. If you use ADO, probably all you will need to change is your connection string, leaving most of the rest intact.

Programatically, in DAO you work with Databases and Recordsets.
In ADO you work with Connections, Commands and Recordsets.

To Open the table MyTable in Database MyDb, this is the way you would go about it in each of the alternatives:

DAO:

Dim db as DAO.Database, DAO.rs as Recordset

Set db = OpenDatabase("MyDb")
Set rs = db.OpenRecordset("MyTable")

ADO

Dim cn as ADODB.Connection, rs as ADODB.Recordset

Set cn = New ADODB.Connection
cn.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & "MyDB" & ";"
cn.Open

Set rs = New ADODB.Recordset
rs.Open "Select * from MyTable", cn

Hope this answered your question!!!

Dabas

0
 
LVL 8

Expert Comment

by:Jeff Tennessen
ID: 8236606
I agree with the general statements made here that ADO is the better choice in most situations. However, DAO is still faster than ADO when going against a Microsoft Jet data source (the database engine in MS Access) and using the Seek statement to find a single row. For most operations, the difference is too small to be noticed; but, if you're sure that any upsizing of your application's data store is far off, and squeezing every ounce of performance out of the app is essential (especially in a loop), it may be worth testing DAO performance vs. ADO before making a final decision.

Jeff
0
 
LVL 12

Expert Comment

by:jyokum
ID: 8236704
I'm pretty sure DAO won't work with the newer versions of MS Access (2000+)
0
 
LVL 27

Expert Comment

by:Dabas
ID: 8236788
To JTennessen's comment:

I am a recent "convert" from DAO to ADO and find that there is not much difference between using Seek in DAO or using "Select * from table where ..." (find the one value you are after). ADO is supposed to use the indexes to find your value as fast as possible. As you yourself say, the difference is too small to be noticed, specially with the speed of modern computers.
If speed is an issue, then I will second the motion of testing, which is difficult as it depends on many other factors such as network cards, amount of users using the system at the same time etc.
For somebody starting, which is the case here, I would still recommend ADO, mainly because it is easier to then "transport" the codes to non-Access Databases.

As somebody who is in the process of doing so presently, I definitely would love to sacrifice a the minimal difference in speed rather than rewriting big chunks of code.

To jyokum's comment:

DAO 3.6 handles MS Access 2000 perfectly!

Dabas
0
 
LVL 8

Expert Comment

by:Jeff Tennessen
ID: 8236826
Dabas, I agree with you in most circumstances, but there are still operations where it does make a difference. For example, try an ADO SELECT statement vs. a DAO Seek on a Jet table with millions of records. The difference is quite noticeable. True, I've read that ADO SELECT uses the table's indexes and, in theory, finds data just as fast as DAO Seek, but our testing has not borne this out.

Your comments re: other factors (NICs, load, etc.) are right on target, which is why I definitely encourage performance testing all possible solutions under the conditions in which they will normally be used.

Again, I'm not trying to argue that DAO is a better general choice than ADO; just that, in certain exceptional circumstances, it may be worth testing it for performance considerations.

Jeff
0
 
LVL 8

Expert Comment

by:Zlatin Zlatev
ID: 8237260
@jyokum,
I am using DAO with no problems in Access 2000
0
 
LVL 8

Expert Comment

by:Zlatin Zlatev
ID: 8237265
@puthuvin, according to me Dabas has provided most useful information in his comments.
0
 

Expert Comment

by:archekrypt
ID: 8238390
ADO kicks @$$ over DAO!!!
ADO is MORE flexible, but somehow DAO is sometimes more speedy...(don't ask)
just a thought...

but personally use ADO, less restrictions, or just use both intertwined!
that could work...
0
 

Expert Comment

by:raseniero
ID: 8255608
when using dao and ado data controls, it's the same!

when you love encoding it i prefer ado! i love to call queries! it's just fun!


disadvantage with ado is when you do this:

sql  = "[tabl] = '" & txt &"'"

- i hate that! i doesn't matches the record unlike dao!

you have to make a condition in a loop to look for it! tedious!

much better when you use ado you practise sql queries!
0
 
LVL 27

Expert Comment

by:Dabas
ID: 8315963
puthuvin:

1) This question was asked quite a while ago, yet you still have not accepted an answer, nor asked for further clarification.

2) You already have another "Ask and Run" incident in your history.

May I suggest you do the fair thing and choose one of the answers above.

Dabas
0
 
LVL 12

Expert Comment

by:jyokum
ID: 8605829
please select a comment as the solution or request a close in the Community Support section
http://www.experts-exchange.com/Community_Support/
0
 
LVL 27

Expert Comment

by:Dabas
ID: 8608845
jyokum:

I doubt we will be that lucky!
Have you asked for closure in CS yourself?

Dabas
0
 
LVL 12

Expert Comment

by:jyokum
ID: 8610179
well it certainly won't happen if you don't ask
0
 
LVL 27

Expert Comment

by:Dabas
ID: 8610837
Have YOU asked in CS yourself?
Does not help if you do so here!
0
 
LVL 12

Expert Comment

by:jyokum
ID: 8611218
oops, misread your post.  I just requested close in CS.
0
 
LVL 1

Expert Comment

by:Computer101
ID: 8625339
A request for deletion or PAQ has been made.  If no response or you feel this is in error, comment.  If no objection, I or another Moderator will handle this question in three days.  If you, the questioner have not answered comments from experts concerning your question, we will ask that you address those before action is taken.

Computer101
E-E Admin
0
 
LVL 27

Expert Comment

by:Dabas
ID: 8625386
Computer101 or Moderator:
I suggest PAQ with points to be shared between the experts that have spent time giving meaningful answers to what is a FAQ.


Dabas
0
 
LVL 1

Expert Comment

by:Computer101
ID: 8634377
PAQ = Previously Asked Question

C101
0
 
LVL 27

Expert Comment

by:Dabas
ID: 8634398
FAQ = Frequently Asked Question
0
 

Expert Comment

by:SpideyMod
ID: 8671325
Answered (sorry remaining experts, but the first answer was VERY thorough and very complete)

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question