Check to ensure server and db available

  • Thread starter Thread starter Earl
  • Start date Start date
E

Earl

When I load the startup form, I want to make a check to ensure the named
server AND database (SQL2k) is available before trying to load any data. Any
recommendations?
 
..... configure and instantiate connection object...

Try
connection.open()
Catch ex As Exception
'Handle inability to open connection here
Finally
connection.close()
End Try
 
The 2.0 Framework has a number of new "factory" classes and service classes
that make this easy. I'll be showing those at VSLive in Orlando in October.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Thanks for the thoughts guys. Just thought maybe there was something more
elegant than capturing an exception :=)

Oh, and when are we to see 2.0 Bill?
 
You can work with it now. The CTPs are fairly stable and good enough to
start building and testing applications for delivery in 2006.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Will do. I actually meant to write that as "... 2.0, Bill", but figured I
might get a response out of "...2.0 Bill" also. =)
 
You have a recommendation on which event to fire this in? Obviously, I could
do the check when a user presses a button, but I'd much rather do it while
the form is loading. I've experimented a bit with this and none of the Form
events seem appropriate.

Miha Markic said:
Try a connect (embedded in try/catch block).

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
SLODUG - Slovene Developer Users Group www.codezone-si.info

Earl said:
When I load the startup form, I want to make a check to ensure the named
server AND database (SQL2k) is available before trying to load any data.
Any recommendations?
 
Back
Top