views:

152

answers:

3

I need to export data into an Access database. My code works, but it works with the assumption the client machine has the Microsoft.Jet.OLEDB.4.0 as a valid provider.

I want to test to see if this is true or not, in code. My problem is that I don't have the location of an existing access database and I don't want to create a new .mdb that I'd use to verify the connection and then delete it.

Is there any way to tell which providers are installed?

+2  A: 

you could try to detect the MDAC version on the machine and based on that extrapolate if your provider is supported?

http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=47262&lngWId=1

here's a snippet you can take a look at.

NoCarrier
I've used this method before with quiet a success. But really you can just simply check the registry key as suggested by @Tomalak
chakrit
A: 

I believe if you have the .NET Framework installed (needed to run VB.NET Code) then the machine has the provider you mention. MSDN

Jason Punyon
+2  A: 

You could simply check for the existence of

HKEY_CLASSES_ROOT\CLSID\{dee35070-506b-11cf-b1aa-00aa00b8de95}

which is the CLSID of Microsoft.Jet.OLEDB.4.0.

Tomalak