未在本機電腦上註冊 Microsoft.ACE.OLEDB.12.0 提供者

來源:互聯網
上載者:User

標籤:ext   com   dbus   ati   trim   連結   本地   總結   mode   

  最近做了一個上位機項目,遇見了很多問題點,一直沒有時間總結。現在項目告一段落,上來總結一下,都是通過網路尋找資料解決的。再次感謝那些前輩,再次做一下記錄,方便同行參考,也方便自己以後查看。

 介面如下:

一:問題點,做使用者登入時出現:“”未在本機電腦上註冊 Microsoft.ACE.OLEDB.12.0 提供者“” 的彈框報錯。

             下面是代碼     

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using MoudelII;namespace Template{    public partial class frmLogin : Form    {        public frmLogin()        {            InitializeComponent();        }        private void button1_Click(object sender, EventArgs e)        {            try            {                string user = textBox_UserName.Text.Trim();                string pwd = textBox_Password.Text.Trim();                if ((user == "") || (pwd == ""))                {                    MessageBox.Show("使用者名稱或密碼錯誤!");                    return;                }                //string strconn = "Provider=Microsoft.ACE.OLEDB.4.0;Data Source=" + Application.StartupPath + @"\db_UserMsg.accdb";                //modAccess access = new modAccess(strconn);                string sql = "select * from tbUserInfo where UserName=‘" + user + "‘ and Password=‘" + pwd + "‘";                DataTable dt = ComData.dbUser.ExecuteDataTable(sql);                if (dt.Rows.Count > 0)                {                    ComData.UserLevel = Convert.ToInt32(dt.Rows[0]["UserLevel"]);                    ComData.UserName = dt.Rows[0]["UserName"].ToString().Trim();                    MessageBox.Show("登入成功!");                    this.Hide();                }                else                {                    MessageBox.Show("使用者名稱或密碼錯誤!");                }            }            catch (Exception ex)            {                MessageBox.Show(ex.Message);            }        }        private void textBox_Password_KeyPress(object sender, KeyPressEventArgs e)        {            if (e.KeyChar == ‘\r‘)            {                button1_Click(sender, e);            }        }    }}

    public static modAccess dbUser = new modAccess("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Application.StartupPath + @"\db_UserMsg.dat

 使用者和密碼,儲存到 :

db_UserMsg.dat 的檔案裡面。
在開發的電腦上無報錯,但拷到裝置上位機裡面就會報:“”未在本機電腦上註冊 Microsoft.ACE.OLEDB.12.0 提供者“”。的錯誤提示。

二:解決方案:https://q.cnblogs.com/q/43682/ 查到這位前輩的部落格,通過他的方法即可解決,再次表示感謝。
下載連結地址
http://download.microsoft.com/download/7/0/3/703ffbcb-dc0c-4e19-b0da-1463960fdcdb/AccessDatabaseEngine.exe

將下載的

 

軟體安裝到電腦即可解決。



 

 

未在本機電腦上註冊 Microsoft.ACE.OLEDB.12.0 提供者

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.