问题
I have a VB.NET project that I have converted from Visual Studio 2008 to Visual Studio 2010. In VS 2008 the project compiles and runs just fine. When I converted it to VS 2010, I get a lot of errors with the DAO objects. This program connects to a SQL database not an Access database. I checked that the DAO reference was added in the project, it was but it says the system cannot find reference specified
.
Here is a screen shot of my my references:

The code and the errors:
Module UpgradeSupport
Friend DAODBEngine_definst As New dao.DBEngine
Error: Type 'dao.DBEngine' is not defined
Dim r As dao.Recordset
Error: Type 'dao.Recordset' is not defined
Dim selProdODBC As dao.Workspace
Error: Type 'dao.Workspace' is not defined
Can someone please tell me what I need to do, in order to make my project work in Visual Studio 2010, like it did in Visual Studio 2008?
回答1:
In order to get DAO to work as a reference in Visual Studio 2010, you have add the ACEDAO.DLL to your project. I got the .DLL file from my machine, it was in the office programs files. Once you add the .DLL file, you will have to add the correct import to your project.
Imports Microsoft.Office.Interop.Access
来源:https://stackoverflow.com/questions/21195380/type-dao-dbengine-is-not-defined-type-dao-recordset-is-not-defined-and-typ