Hello, I am putting together an application that connects to a vfp database. I have it working fine if I define my connection string in the app.config file -
<add name="vFoxProSource" connectionString="Provider=vfpoledb;Data Source=C:\directory\database.dbc;Collating Sequence=machine;" providerName="System.Data.OleDb.OleDbConnection, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
Ultimately, the path to the source will be dynamic, so I am trying to define the connection string using ConnectionStringSettings. I have the following code -
ConnectionStringSettings vfpConnectionStringSettings = new ConnectionStringSettings();
vfpConnectionStringSettings.ProviderName = "System.Data.OleDb.OleDbConnection, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
vfpConnectionStringSettings.ConnectionString = ".. my connection string...";
When I run this code, I am getting the following error -
The 'System.Data.OleDb.OleDbConnection, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' provider is not registered on the local machine.
I have even tried pulling the provider name directly from the connection string that is working successfully, but I get the same error. Does anyone have any idea why it is working one way, but not the other?
Thanks