none
The 'Microsoft.ACE.OLEBD.12.0' provider is not registered on the local machine. (NEWBIE) RRS feed

  • Question

  • Hello

    I am trying to connect to my Access 2007 database via C# / ADO.net. My website/database is running via IIS on my local machine.

    I believe (and hope) my code is accurate (see below) but I get the error message:

    The 'Microsoft.ACE.OLEBD.12.0' provider is not registered on the local machine.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.InvalidOperationException: The 'Microsoft.ACE.OLEBD.12.0' provider is not registered on the local machine.


    My code:

    using System;
    using System.Data;
    using System.Data.OleDb;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;


    public partial class connectors_board_to_board_connector_result : System.Web.UI.Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {

            string strConn = @"Provider=Microsoft.ACE.OLEBD.12.0;Data Source=C:\Inetpub\wwwroot\website01\databse.accdb;Persist Security Info=False;";
            string strSQL = "SELECT * from dbo_tb_table01";

            OleDbConnection oleConn = new OleDbConnection();
            OleDbCommand oleCmd = new OleDbCommand();
            OleDbDataAdapter oleDA = new OleDbDataAdapter();

            oleCmd.CommandText = strSQL;
            oleCmd.CommandType = CommandType.Text;
            oleCmd.Connection = oleConn;
            Trace.Write("Have Entered Program");
            oleConn.ConnectionString = strConn;

            oleDA.SelectCommand = oleCmd;

            oleConn.Open();

            DataSet ds = new DataSet();

            oleDA.Fill(ds);

            grdAccess.DataSource = ds;
            grdAccess.DataBind();

        }
     }
    Wednesday, October 8, 2008 8:42 AM

Answers

All replies