在'Microsoft.Jet.OLEDB.4.0'提供者未在本地计算机上注册 [英] The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine

查看:710
本文介绍了在'Microsoft.Jet.OLEDB.4.0'提供者未在本地计算机上注册的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以帮助我这个错误?当我尝试打开一个MDB的连接,我得到错误'Microsoft.Jet.OLEDB.4.0'提供者未在本地计算机上注册。我怎样才能解决这个?

我的code是pretty的简单:

 类ImportTDB {
    私人字符串的文件名;
    私人字符串的connectionString;

    私人诠释碰撞= 0;

    公共ImportTDB(字符串文件名){
        this.filename =文件名;
        this.connectionString =供应商= Microsoft.Jet.OLEDB.4.0;数据源=+文件名;
    }

    公共无效loadCustomerList(){
        数据表DT =新的DataTable();
        使用(OleDbConnection的康恩=新的OleDbConnection(的connectionString)){
            OleDbDataAdapter的适配器=新OleDbDataAdapter的(SELECT * FROM名称,康涅狄格州);
            conn.Open();
            adapter.Fill(DT);
            conn.Close();
        }

        Console.WriteLine(dt.ToString());
    }
}
 

解决方案

这是因为没有喷气驱动对于64位系统的,我想你正试图在64位操作系统上运行此。您需要编译程序的目标86。在项目属性,生成选项卡,设置平台目标x86的。

Can someone help me with this error? When I try to open a connection to an mdb, I get "The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine" error. How can I correct this?

My code is pretty simple:

class ImportTDB {
    private string filename;
    private string connectionString;

    private int collisions = 0;

    public ImportTDB(String filename) {
        this.filename = filename;
        this.connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filename;
    }

    public void loadCustomerList() {
        DataTable dt = new DataTable();
        using (OleDbConnection conn = new OleDbConnection(connectionString)) {
            OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM Names", conn);
            conn.Open();
            adapter.Fill(dt);
            conn.Close();
        }

        Console.WriteLine(dt.ToString());
    }
}

解决方案

That's because there is no Jet driver for 64-bit systems and I suppose you are trying to run this on a x64 bit OS. You need to compile your program to target x86. In the project properties, Build tab, set Platform target to x86.

这篇关于在'Microsoft.Jet.OLEDB.4.0'提供者未在本地计算机上注册的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆