C # program debugging appears "Microsoft.Jet.OLEDB.4.0" Provider is not registered on the local computer. ”

Source: Internet
Author: User
Tags pack

The simple program code is as follows:
DataSet ds=new DataSet ();
Try
{
String Strcon = @ "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=e:\test.xls; Extended properties= ' Excel

8.0; Hdr=yes;imex=1 ' ";
OleDbConnection olecon = new OleDbConnection (Strcon);
Olecon.open ();
OleDbDataAdapter Oleda = new OleDbDataAdapter ("SELECT * from [sheet$]", Olecon);
Oleda.fill (DS);

catch (Exception ex)
{
MessageBox.Show (ex. Message + ex. Source + ex. innerexception);
}
Error: "Microsoft.Jet.OLEDB.4.0" Provider is not registered on the local computer. System.Data

Issues and workarounds to be aware of:

1.microsoft.jet.oledb.4.0 do not write miscrosoft.jet.oledb.4.0,;
2.Data source does not write "Data sourse",
3. Check if Office is installed
4. Reinstall the registration MDAC28.exe (usually in your VS installation directory or up to Microsoft's official website)
Http://access911.net/fixhtm/72FABF1E14DC.htm?tt= (this address was given by a friend)
5. This may also occur if you are a 64-bit platform; Workaround: Build, configure manager, platform, click any CPU tab, new-New platform->x86

-------------------------------

The premise of this method is that the ConnectionString you are writing is correct, as in the form of:
Provider=microsoft. Jet.oledb.4.0;data source=; Jet oledb:database password=xxx;

If, at this point, you are prompted for "provider not found" or "improperly installed," the reason is that the information in the registry for a Jet 4.0 DLL is damaged or lost for some reason, as follows:

Start---> Run, input regsvr32 msjetoledb40.dll, enter.

A reboot is recommended and the problem can be solved.
/////////////////////////////////////////////////

Attached: Jet 4.0 Service Pack 8
Jet 4.0 Service Pack 8 (SP8) for Windows 95/98/nt 4.0
Quick Description
Microsoft Jet 4.0 Service Pack 8 (SP8) provides the latest updates to the Microsoft Jet 4.0 database engine. Download it now to get the latest version of several files that are used by Microsoft products that are consolidated with Microsoft Jet 4.0.
Http://www.microsoft.com/downloads/details.aspx?FamilyID=4335216c-8cdd-4168-a030-46f815d3f5cd&DisplayLang=zh-cn

C # program debugging appears "Microsoft.Jet.OLEDB.4.0" Provider is not registered on the local computer. ”

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.