none
Windows 7 : C# Error: Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine

    Question

  • Hey Guys,

    I am using windows 7 and Visual studio 2008 and writing the simpliest program tht connects to access database, with the following string:

    string strAccessConn = "Provider=MicrosoftJet.OLEDB.4.0;Data Source=C:\\Users\\yura\\Desktop\\PersonDatabase.mdb";

    When I create the connection and do open(), it throws exception with the following msg:

    Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine



    I read this  http://social.msdn.microsoft.com/forums/en-US/adodotnetdataproviders/thread/45aa44dd-0e6f-42e5-a9d6-9be5c5c8fcd1/    thread. Tried to do regsrv32, also tried to go to Project properties -> Build ->Platform Target ->x86  but nothing helped.

    Can you please help me out? How can I connect and open Access db with C# vstudio 2008 on windows 7?

    Thanks!
    Yura
    Tuesday, November 10, 2009 8:40 AM

Answers

All replies

  • One more thing....   I noticed that I have to change target CPU and not platform target.

    MSD Help:

    To set the Target CPU property

    1. With a project selected in Solution Explorer , on the Project menu, click Properties .

    2. Click the Compile tab.

    3. Click the Advanced Compile Options button to open the Advanced Compiler Settings dialog box.

    4. Choose a CPU type from the Target CPU drop-down list. The options are AnyCPU (the default), x86 , x64 , or Itanium . Click OK .




    However, I DO NOT have a complie tab...!

    I just have the fllowing tabs on the left:

    Application
    Build
    Build Evens
    Debug
    Resourses
    Services
    ...

    No "Compile" Tab.!!
    • Proposed as answer by minghetti ennio Wednesday, September 22, 2010 10:41 AM
    Tuesday, November 10, 2009 9:16 AM
  • I believe it is under the Build tab, called platform target.

    /platform (Specify Output Platform) (C# Compiler Options)
    http://msdn.microsoft.com/en-us/library/zekwfyz4.aspx
    This posting is provided "AS IS" with no warranties.
    Tuesday, November 10, 2009 10:00 AM
  • As I described in the first post, I already did change the platform target to x86 , recompiled and still got the error...
    There was just some thead I read that it has to be Target CPU ( and not platform ) this is the reason I indicated this... but if platform and CPU is the same, so my platform is already configured to x86.


    p.s. I am a newbie, so I also might have some stupid issues like Microsoft.Jet.OLEDB is not installed...  so any proposal are welcomed.

    p.s.s. By the way, how do I check that the Microsoft.Jet.OLEDB is indeed installed? I do have the
    C:\Windows\SysWOW64\msjet40.dll  file.  And as I said, I also tried to do regsvr32 on it, but it did not solve the problem


    Thanks
    Tuesday, November 10, 2009 10:53 AM
  • Jet OLEDB is depricated and is not installed with operating system since MDAC 2.6 (might be 2.5). Anyway, you need to use new ACE OLEDB provider instead of Jet in your applications and install it on target PC where application should run. You can download ACE installation here

    http://www.microsoft.com/downloads/details.aspx?FamilyID=7554F536-8C28-4598-9B72-EF94E038C891&displaylang=en


    Val Mazur (MVP)

    http://www.xporttools.net

    Tuesday, November 10, 2009 11:00 AM
    Moderator

  • VMazur, you are the KING!  Thank a lot! I was going through forums for the last two days and spent so much time...

    Thanks a lot for your help :)



    I have one more question:  In the link you have provided, there is this note:

  • If you are application developer using ODBC to connect to Microsoft Office Access data, set the Connection String to “Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=path to mdb/accdb file”

  • I did not add this line and it seemed to open the db ok. What does this line mean? When should I use it?
Tuesday, November 10, 2009 11:21 AM
  • The connection string you mention is for the MS Access ODBC driver. You do not need it if you're using the ACE OLEDB Provider.
    Paul ~~~~ Microsoft MVP (Visual Basic)
    Tuesday, November 10, 2009 3:42 PM
  • Yeha, but why they indicate this string in the downlowad page of ACE OLEDB provider, if this got nothing to do with it??
    Wednesday, November 11, 2009 7:12 AM
  • It's not just ACE download. The download installs all data access components (ODBC, OLEDB drivers, etc) related to the Microsoft Office. In your case you do not need to worry about ODBC


    Val Mazur (MVP)

    http://www.xporttools.net

    Wednesday, November 11, 2009 11:03 AM
    Moderator
  • OK. Got everything working.

    Thanks a lot  :)
    Tuesday, November 17, 2009 9:58 AM
  • I know this is an old thread but I am just now switching to windows 7 and I am encountering this same error. I have changed the platform to x86 and I've downloaded and installed the program from the link above but I'm still getting the same error that it is not registered. Any other things I need to check/change?

     

    The Machine I'm testing on is a virtual machine if that makes any difference. Also it is not a web app.

    Wednesday, June 30, 2010 3:44 PM
  • Could you post your connection string?

    Paul ~~~~ Microsoft MVP (Visual Basic)
    Wednesday, June 30, 2010 5:19 PM
  •        _lConn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source="  + AccessDB + ";Mode=Share Deny None;Extended Properties='';Jet OLEDB:System database='';Jet OLEDB:Registry Path='';Jet OLEDB:Engine Type=4;Jet OLEDB:Database Locking Mode=0;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False");

     

    It is accessing Access97 databases and I'm stuck with that version of Access due to other applications used in the company.

    Wednesday, June 30, 2010 6:09 PM
  • I am getting the same error. I am trying to connect to Access (2007) db, with VS2008 on windows 7 and got stuck. Also tried installing the 2007 Office System Driver from the link above but it didn't work either for me. Any other solution so far?

    Thanks,


    Thursday, July 01, 2010 5:46 PM
  •        _lConn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source="  + AccessDB + ";Mode=Share Deny None;Extended Properties='';Jet OLEDB:System database='';Jet OLEDB:Registry Path='';Jet OLEDB:Engine Type=4;Jet OLEDB:Database Locking Mode=0;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False");

     

    It is accessing Access97 databases and I'm stuck with that version of Access due to other applications used in the company.

    You are using the Jet OLEDB Provider so downloading and installing the ACE Provider won't help unless you want to use that instead. I would recommend removing most of the arguments from the connection string. All that you need are the Provider and Data Source unless your settings deviate from the default.

    _lConn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + AccessDB);

    You could probably use the ACE Provider as well if it is installed. See the below link for examples:

    http://www.connectionstrings.com/access-2007

     


    Paul ~~~~ Microsoft MVP (Visual Basic)
    Thursday, July 01, 2010 7:34 PM
  • I am getting the same error. I am trying to connect to Access (2007) db, with VS2008 on windows 7 and got stuck. Also tried installing the 2007 Office System Driver from the link above but it didn't work either for me. Any other solution so far?

    Thanks,



    You're probably going to need to explain what you mean by "got stuck". Would also help to know which version of Windows you are using.

    Paul ~~~~ Microsoft MVP (Visual Basic)
    Thursday, July 01, 2010 7:36 PM
  • Thanks guys, you all rock, as an FYI, the exact connection string for ACE is like -

     

    "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path to DB file.

    Sunday, July 04, 2010 12:37 AM
  • In the connectionstrings I've seen for this provider it seems to work with *.aacdb-files, I still need to connect to a legacy .mdb file, what is the modern way to do that if Jet OLEDB is deprecated?
    • Edited by deap82 Sunday, August 15, 2010 11:37 AM spelling mistake
    Sunday, August 15, 2010 11:36 AM
  • hey thanks vmazur it really worked
    Saturday, July 23, 2011 4:07 PM
  • You have to install database engine for Windows 7 from Microsoft site http://download.microsoft.com/download/2/4/3/24375141-E08D-4803-AB0E-10F2E3A07A.

    After installation try it.

    Tuesday, August 02, 2011 8:09 AM
  • Hi,

    I've got similar problem as yurako had.

    I've got this application which I wrote on x32 Windows XP system.

    It had connected to Microsoft.Jet.OLEDB.4.0. like this:

    Dim conn As New OleDbConnection(String.Format("Provider=" & _

                   "Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=""DBASE 5.0"";", path))

    i've moved this app on a different computer with Windows 7 x64 system.

    The error is: Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine.

    I've tried to change to ACE OLEDB. I've installed this AccessDatabaseEngine which VMazur pointed and tried:

    Dim conn As New OleDbConnection(String.Format("Provider=" & _

                    "Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=""DBASE 5.0"";", path))

    but it still doesn't work. It catches the same exception: provider is not registered.

     

    I also have a problem with DataCodePage changing.

    regKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\Microsoft\Jet\4.0\Engines\Xbase", True)

                regKey.SetValue("DataCodePage", "ANSI")

    Since there's no Microsoft.Jet.OLEDB it also doesn't work.

    Can someone help me, please? 

    What should I do to make it working?

     

    Thank You,

    Gutek

     

     

    Monday, November 14, 2011 6:37 PM
  • Hi Dear Yurako,

    Thank you for your assistance, it works for me .

    regards,

    Lakshman Teja

    Sunday, April 22, 2012 12:03 PM