Error: "Not registered on the local computer" Microsoft. ace.oledb.12.0 "

Source: Internet
Author: User
Tags odbc ole

C # accesses Excel error message through OLE DB: Microsoft is not registered on the local computer. ace.oledb.12.0 "provider. The online query learns that you need to download the Microsoft Access 2010 Database Engine Redistributable package to install. As: https://www.microsoft.com/zh-CN/download/details.aspx?id=13255.

Supported operating Systems

Windows 7, Windows 8, Windows Server 2003, Windows Server 2003 Service Pack 1, Windows Server 2003 Service Pack 2, Windows Server R2, Windows Server Service Pack 2, Windows Vista Service Pack 1, Windows XP Service Pack 2

        only 32-bit Access database engine can be used on Windows XP Service Pack 3

Usage scenarios:

  1. If you are using OLE DB application, set the Provider parameter of the ConnectionString property to "microsoft.ace.oledb.12.0".  

    If you connect to Microsoft Office Excel data, add the appropriate OLE DB connection string extension properties based on the Excel file type:  

    File type (extension)    & nbsp                                        Extended Properties
    ------------------------------------------------------------------------------ ---------------
    Excel 97-2003 workbook (. xls)                   & nbsp                "Excel 8.0"
    Excel 2007-2010 Workbook (. xlsx)                               "Excel 12.0 Xml"
    Enable macro Exce L 2007-2010 Workbook (. xlsm)       Excel 12.0 macros
    Excel 2007-2010 non-XML binary workbook (. xlsb)       "Exce L 12.0 "

  2. If you are an application developer who uses ODBC to connect to Microsoft Office Access data, set the connection string to "Driver={microsoft Access Driver (*.mdb, *.accdb)};D bq= Path to mdb/accdb file "
  3. If you are an application developer who uses ODBC to connect to Microsoft Office Excel data, set the connection string to "Driver={microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xls b)};D bq=path to xls/xlsx/xlsm/xlsb file "

A test example:

1   Public StaticDataTable GetData (stringfileName)2         {3             if(! File.exists (FileName))return NULL;4             //string connstr = string. Format (@ "Provider=mmicrosoft.ace.oledb.12.0;data source= ' {0} '; Extended properties= ' Excel 8.0; Hdr=yes;imex=1 '; ", fileName);5             stringConnStr =string. Format (@"provider=microsoft.ace.oledb.12.0;data source= ' {0} '; Extended properties= ' Excel 12.0; Hdr=yes;imex=1 ';", fileName);6             using(OleDbConnection conn =NewOleDbConnection (connstr))7             {8 9                 TryTen                 { One Conn. Open (); ADataTable DT = conn. GetOleDbSchemaTable (OleDbSchemaGuid.Tables,NULL); -                     vartableName = dt. rows[0][2]. ToString (). Trim (); -                     stringCmdtxt =string. Format ("SELECT * from [{0}]", tableName); the                  -                 //trace.write ("Enquiry form:" + cmdtxt); -OleDbDataAdapter da =NewOleDbDataAdapter (Cmdtxt, conn); -DataSet ds =NewDataSet (); + da. Fill (DS); -                     returnDs. tables[0]; +                 } A                 Catch(Exception e) at                 { -  -                   //trace.writeline ("GetData error:" + e.message); -                     return NULL; -                 } -                 finally in                 { - Conn. Close (); to                 } +             } -}

Error: "Not registered on the local computer" Microsoft. ace.oledb.12.0 "

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.