I've a project that connects to a dBase format database file, that I've always done in the past with a connection string of the form of:
PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=MyData.dbf;Extended Properties=dBASE 5.0
I've had to revisit this recently, and have found that when attempting to create an OleDbConnection
with that connection string on x64 machines, that have an x86 install of Office on it, it throws an exception.
A quick hack of a fix shows that forcing the application to target x86 only makes it work, but I was hoping to be able to tidy this up and check in advance whether it would fail to create the connection, so that I could customise my import options to suit the available providers.
Is it possible to enumerate the available data providers for the current processor architecture? (other than relying on catching the exception -- after all, the Framework Design Guidelines suggest that you should only throw in exceptional circumstances, and you have a method to check if something would throw an exception)