0

I'm trying to connect to a dBase (.dbf) database by VB.Net, I installed vfpoledb provider and use connection string like bellow :

  Dim cn As New OleDb.OleDbConnection With {.ConnectionString = "Provider=vfpoledb.1;Data Source=[MyAddress]"}

I got an error like this only in specific project :

The 'vfpoledb.1' provider is not registered on the local machine

my project is compile on x86 platform and when I create a new project and use same code, everything is OK. only my main project got this error.

both of my projects have same compiling options

Navid Asadi
  • 61
  • 1
  • 5
  • Looking at [Visual FoxPro connection strings](https://www.connectionstrings.com/visual-foxpro/), it appears to me that the `.1` shouldn't be there, i.e. `.ConnectionString = "Provider=vfpoledb;Data Source=[MyAddress]"`. – Andrew Morton Dec 16 '18 at 17:40
  • A side note. You can pass the connection string directly to the constructor of the connection. No With or braces necessary. – Mary Dec 16 '18 at 19:31
  • Thanks for your attentions, I removed the .1 from my connection string and didn't happened any thing! I'm using this connection in other projects at this PC and its work well. – Navid Asadi Dec 17 '18 at 03:52
  • It might be worth checking again that it really is compiling for x86. Otherwise, would it be too much work to create a new project, confirm that the connection works, and transfer the code across to the new projet? – Andrew Morton Dec 17 '18 at 13:33
  • I believe that my project have problem or some wrong settings, I tested my projects on other PCs and every things was right! both projects compiling options are same. – Navid Asadi Dec 18 '18 at 07:04
  • Dear @AndrewMorton, My project is really big and I could NOT rebuild it, it's a very small plugin for that, maybe I write a DLL to do the job! – Navid Asadi Dec 18 '18 at 07:16
  • I'm very confused! I made a DLL that's work correctly on all projects except my main project! I try to add a reference named "Microsoft OLE DB Provider for Visual FoxPro 7.0 Type Library" to my main project but I got Error "could not be added"; it's worked on other projects!! – Navid Asadi Dec 18 '18 at 08:48
  • @user3080525 Have you tried re-installing the provider, in case it has become corrupted? – Andrew Morton Dec 18 '18 at 09:51
  • Possible duplicate of [Getting the error "The 'VFPOLEDB.1' provider is not registered on the local machine" even after installing and registering the provider](https://stackoverflow.com/questions/15684575/getting-the-error-the-vfpoledb-1-provider-is-not-registered-on-the-local-mach) – Andrew Morton Dec 18 '18 at 14:23

1 Answers1

0

Finally I found the problem, my main application must run as administrator but other projects run as current user, so I removed "Provider" and reinstalled it. I found that the default option on setup is "Just me"; I changed it to "Everyone" and the problem fixed.

Select every one option

Andrew Morton
  • 24,203
  • 9
  • 60
  • 84
Navid Asadi
  • 61
  • 1
  • 5