Click here to Skip to main content
15,885,182 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi,
Does anyone know how to retrieve the data from Access MDB file using DAO?
Please help.
What references, dll's do I need?
I can't find any examples.
Thanks.
Posted
Updated 19-Jun-22 9:17am

In VS 2010, open the "Solution Explorer" > "Reference" > "Add Reference" > ".Net", you can see the component "dao", add it to reference.

Now you can use DAO in your project. See below:

internal static dao.Database DAODataBase;
private dao.Workspace DAOWorkSpace;
private dao.DBEngine DAODBEngine = new dao.DBEngineClass();
DAODataBase = DAOWorkSpace.OpenDatabase("C:\\MyData.mdb", null, null, ";pwd=");
internal static dao.Recordset DAOFoundCode;

Dao is faster than OleDB. I retrieve 20000 row data from 350000 row data with 140 ~ 200 ms, but OleDB needs 500 ms to fill DataSet.


Iao
 
Share this answer
 
Comments
Member 13955321 20-Aug-18 10:39am    
I know that is a old post but can somebody pls pls post a code examp. How to insert something with DAO in c#?
DAO is really an old data access mechanism. Skip it, and start using OLE DB[^]
 
Share this answer
 
Comments
milanski19 9-Jun-11 8:58am    
I know it is, and I made it work the new way with ADO instead and OLE DB but this was a converted Application from VB to C# and it has DAO mechanism in there and also uses an old 97 Access read only DB so I need to fix that. Other than that of course I wouldn't bother with it but I was asked to fix it as is.
Thanks for replies my friends.
Uday P.Singh 26-Jun-11 14:42pm    
good answer my 5!
Kim Togo 27-Jun-11 3:33am    
Thanks Uday
Why? DAO was deprecated well over a decade ago.

There's a reason you can't find any examples. Noone uses it anymore!
 
Share this answer
 
Comments
milanski19 9-Jun-11 9:00am    
I know it is, and I made it work the new way with ADO instead and OLE DB but this was a converted Application from VB to C# and it has DAO mechanism in there and also uses an old 97 Access read only DB so I need to fix that. Other than that of course I wouldn't bother with it but I was asked to fix it as is. Thanks for replies my friends.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900