DSN, Check if exists

  • Thread starter Thread starter Bernie Hunt
  • Start date Start date
B

Bernie Hunt

My application needs to run at many different sites and I need to depend on
a DSN set up by another application, so I want to check for the DSN's
existance right up front before bothering to do anything else.

I found this link
http://groups.google.com/group/microsoft.public.dotnet.framework.odbcnet/br
owse_thread/thread/5fe8e285241d87a/f6b7bb38bced6cb9?
lnk=st&q=.net+check+if+dsn+exists&rnum=1&hl=en#f6b7bb38bced6cb9

Where Paul provided a great example of how to grab the list of all DSNs and
then walk through the list.

Is there better way in VS05 to check for a single DSN?

Thanks,
Bernie
 
¤ My application needs to run at many different sites and I need to depend on
¤ a DSN set up by another application, so I want to check for the DSN's
¤ existance right up front before bothering to do anything else.
¤
¤ I found this link
¤ http://groups.google.com/group/microsoft.public.dotnet.framework.odbcnet/br
¤ owse_thread/thread/5fe8e285241d87a/f6b7bb38bced6cb9?
¤ lnk=st&q=.net+check+if+dsn+exists&rnum=1&hl=en#f6b7bb38bced6cb9
¤
¤ Where Paul provided a great example of how to grab the list of all DSNs and
¤ then walk through the list.
¤
¤ Is there better way in VS05 to check for a single DSN?

The only other way I know of would be to query the Registry sub key (with your DSN name) under:

HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI


Paul
~~~~
Microsoft MVP (Visual Basic)
 
Thanks Paul!

I'll stick with your previous example. It works fine and doesn't take a
lot of time.

Bernie
 
Back
Top