简体   繁体   English

使用Visual Studio 2010访问2010数据库

[英]Access 2010 database with Visual Studio 2010

I have an Access 2010 database that I am trying to access in a Windows Form Visual Studio application. 我有一个Access 2010数据库,试图在Windows Form Visual Studio应用程序中访问。

Here is my code: 这是我的代码:

         strDB = " Provider=Microsoft.ACE.OLEDB.12.0;Data Source="



        strDB = strDB & pstrPathName


        ' the connection object
        mdbDatabase = New OleDbConnection(strDB)

        ' open the connection
        mdbDatabase.Open()

It fails to work. 它无法工作。 The Message I get is “Microsoft.ACE,OLEDB.12.0” provider is not registered on the local machine. 我收到的消息是“ Microsoft.ACE,OLEDB.12.0”提供程序未在本地计算机上注册。

I was advised in another Forum to try to install AccessDatabaseEngine.exe. 在另一个论坛中建议我尝试安装AccessDatabaseEngine.exe。 That program installed ok but it didn't help. 该程序安装正常,但没有帮助。 Any thoughts? 有什么想法吗?

Bob 鲍勃

I found the answer in another Forum 我在另一个论坛中找到了答案

1) Right Click on the Project, choose Properties 2) Choose Compile 3) Click on Advance Compile 4) Under Option, pick Target CPU 5) Chnage to x86. 1)右键单击项目,选择“属性” 2)选择“编译” 3)单击“高级编译” 4)在“选项”下,选择“目标CPU” 5)将代码转换为x86。

Bob 鲍勃

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM