PC Review Forums Newsgroups Microsoft DotNet Microsoft ADO .NET DSN, Check if exists

Reply

DSN, Check if exists

 
Thread Tools Rate Thread
Old 09-04-2006, 03:26 PM   #1
Bernie Hunt
Guest
 
Posts: n/a
Default DSN, Check if exists


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/micr...work.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
  Reply With Quote
Old 10-04-2006, 03:03 PM   #2
Paul Clement
Guest
 
Posts: n/a
Default Re: DSN, Check if exists

On Sun, 09 Apr 2006 07:26:49 -0700, Bernie Hunt <bhunt@optonline.net> wrote:

¤ 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/micr...work.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)
  Reply With Quote
Old 10-04-2006, 04:40 PM   #3
Bernie Hunt
Guest
 
Posts: n/a
Default Re: DSN, Check if exists

Thanks Paul!

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

Bernie



Paul Clement <UseAdddressAtEndofMessage@swspectrum.com> wrote in
news:58pk329r1f22js6ntmv5i8o3okrpergm4j@4ax.com:

> On Sun, 09 Apr 2006 07:26:49 -0700, Bernie Hunt <bhunt@optonline.net>
> wrote:
>
> ¤ 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/micr....framework.odbc
> net/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)
>


  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off