Importing DAO into .NET Project

  • Thread starter Thread starter Siegfried Heintze
  • Start date Start date
S

Siegfried Heintze

Someone in the Access forum explained that I could retrieve metadata from
Access with the DAO API. I specifically what to retrieve the comments for
each column and table. I also want to retrieve the control associated with
each column in MSAccess.

When I fired up VS.NET to start the project, I could not find the DAO to
import! Where is it? I assume it is a COM interface. I think there is a C
interface too for DAO -- what is that called? Is there a native .NET
interface too?

Thanks,
Siegfried
 
DAO has been a dead technology for over 5 years.
ADO replaced DAO.
While you can make a COM reference in .NET to the ADO library, .NET's native
database connection technology is ADO.NET.
 
Seigfried,
While it is best to use ADO.NET in preference to ADO and it is better to use
ADO than DAO, DAO is still around. We just don't know for how long because
it is an obsolescent technology - it may be dying but it's not dead yet.

For properties of tables and columns, you'd be better off looking at the
System.Data.DataTable and System.Data.DataColumn objects in VS.NET if you're
starting from scratch - that's the direction things are going. I'm not sure
if AdoDotAnything will retrieve the property for the "Display Control" of an
Access table - I haven't tried that.

However, if you need to port DAO into .NET, you should be able to do it. I
can see a COM reference to "Microsoft DAO 3.6 Object Library" as well as
references to earlier versions of DAO when I add a reference to a VB.NET
project. If you have the file "C:\Program Files\Microsoft
Shared\DAO\dao360.dll", for example, on your PC but it's not showing up as a
COM reference, it's just not registered properly.

Hope this helps,
David Straker
 
For properties of tables and columns, you'd be better off
looking at the System.Data.DataTable and
System.Data.DataColumn objects in VS.NET if you're
starting from scratch - that's the direction things are
going. I'm not sure if AdoDotAnything will retrieve
the property for the "Display Control" of an
Access table - I haven't tried that.

I've tried that -- did I miss something? I wrote a program that used a
treeview view to display everything I could find in the DataTable and
DataColumn and I could not find the MSAccess specific metadata like the
comments for the table and the columns and the control type used for
each column.

This does not surprise me -- why would a generic API have MSAccess
specific stuff. I also tried using ADOX and could get some but not all
of the metadata.

MSAccess is the only database (that I know of) that lets you store a
control (checkbox, dropdown list, etc...) for each column you define.

So why do you say DAO is going away? I hope not! It is the only way of
doing MSAccess specific stuff! Is there a better API for MSAccess
specific stuff? That would be nice! Or should I infer from you statement
that MSAccess is not dead yet but dying?

Thanks,
Siegfried
 
I cannot find "C:\Program Files\Microsoft
Shared\DAO\dao360.dll", on my computer because I don't have a
"Microsoft Shared" directory. Where else might I look for it?
 
Siegfried,

I disagree with David. DAO is a dead technology, it's not going away, it's
already gone. MS doesn't support it (and hasn't for quite some time) and
there have been 2 new generations of data accessing technologies since DAO.

As for your comment that it is the only way of doing MS Access specific
stuff, that's not true at all.

In .NET, you could connect to an Access DB like this:

Dim conStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("db.mdb")
Dim sqlStr As String = "Select ....ORDER BY ...."

Dim con As OleDb.OleDbConnection
Dim cmd As OleDb.OleDbCommand

con = New OleDb.OleDbConnection(conStr)
cmd = New OleDb.OleDbCommand(sqlStr, con)

con.Open()

Now, once you have your connection object open, you can do many things, use
a DataReader (for read only - connected - forward only access), use a
dataSet, use a datatabe, a dataview, etc.

-Scott
 
Seigfried,
Sorry I gave you the wrong folder for the DAO dll - late night stupidity I
think.

There are a lot of indicators that DAO is being phased out. The absence of a
..NET assembly for DAO in VS.NET is a pretty good indicator in itself of the
direction that Microsoft is going. I also agree that there are aspects of
the Access schema that are way beyond any other - like the ability to define
the default control for a column. But it looks like we're being strongly
encouraged to move away from DAO. I seem to remember coming across some info
in that line earlier this year but I can't remember where - probably the
Microsoft web site. As far as Access is concerned, I don't see it as
obsolescent technology and I've heard nothing along those lines. imho I
think its a work of genius. In fact, the Microsoft Access Product Team are
currently calling for input to make sure that mdb conversion to the next
version is as robust as possible.

I've only written schema interrogators using ADOX and ADO.NET primarily for
data validation routines prior to database updates. Things like "is the
user's data valid based on the schema definition for the column" so I
haven't delved into the extended column properties like "description" or
"default control". I'll give it a try when I have some time over the next
few days and let you know what I find.

David Straker
 
¤ Someone in the Access forum explained that I could retrieve metadata from
¤ Access with the DAO API. I specifically what to retrieve the comments for
¤ each column and table. I also want to retrieve the control associated with
¤ each column in MSAccess.
¤
¤ When I fired up VS.NET to start the project, I could not find the DAO to
¤ import! Where is it? I assume it is a COM interface. I think there is a C
¤ interface too for DAO -- what is that called? Is there a native .NET
¤ interface too?
¤

You may also want to try GetOleDbSchemaTable before reverting to DAO or ADOX:

HOW TO: Retrieve Schema Information by Using GetOleDbSchemaTable and Visual Basic .NET
http://support.microsoft.com/default.aspx?scid=kb;en-us;309488&Product=adonet


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
Siegfried,
I can't find any way of retrieving Access-specific column properties (like
the control associated with the Access column) in ADO.NET. It may be
possible but I can't see it. I can infer one in code, from data type,
foreign keys, etc. in ADO.NET but that's pretty laborious. Sorry I couldn't
help, dude.

Will somebody from Microsoft please step in and give the facts to Scott M.
on support for DAO. He's posting the same statements about it not being
supported for 5 years in at least one other forum. I know that the big move
is towards ADO.NET but DAO is in Windows XP which is the most recent version
of Access, Access XP is supported by Microsoft therefore DAO is supported by
Microsoft. Isn't that "Logic 101"?

David Straker
 
David Straker said:
Siegfried,
I can't find any way of retrieving Access-specific column properties (like
the control associated with the Access column) in ADO.NET. It may be
possible but I can't see it. I can infer one in code, from data type,
foreign keys, etc. in ADO.NET but that's pretty laborious. Sorry I couldn't
help, dude.

Will somebody from Microsoft please step in and give the facts to Scott M.
on support for DAO. He's posting the same statements about it not being
supported for 5 years in at least one other forum. I know that the big move
is towards ADO.NET but DAO is in Windows XP which is the most recent version
of Access, Access XP is supported by Microsoft therefore DAO is supported by
Microsoft. Isn't that "Logic 101"?

David, try to understand what I'm saying:

There is a difference between providing a technology for backwards
compatibilty and supporting it. MS has not supported DAO in years. By
support, I mean respond to technical inquiries about it or build new
applications using it. I don't mean include it in a product that always had
it.

If you were to call MS and ask them for support with some aspect of DAO,
they would tell you that they no longer support technical inquiries on DAO
and point you to some MSDN article perhaps.

Above you write: "Windows XP which is the most recent version of Access...".
Umm, no. WindowsXP is the most recent version of Windows (home use).
AccessXP is not a part of Windows, nor does it come with WindowsXP.

You wrote: "Access XP is supported by Microsoft therefore DAO is supported
by Microsoft. Isn't that "Logic 101"?"
Umm, no. AccessXP may allow you to use DAO (I actually don't think it will,
but haven't tried it), but it's native data technology is ADO (as it was as
well in Access 2000).

My entire point Dave is that DAO is the road backwards, you can still walk
it if you like, but MS has had a new road in place for many years now (ADO)
and they even have a newer one (2 years+ already) ADO.NET.

You misunderstand "support" for "can use".
 
Back
Top