ADO.Net Connection Question

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

Hi,

What is the best way to test to see if a MS SQL DB is running? Does it
throw a specific error when trying to connect to it that I can catch? I am
trying to design my application if the db server is offline to save the db
info locally. Any ideas?

Thanks
 
Hi Mike,

If connection failed during opening, then you should get SqlException
exception. What you need to do is to place only Open method of the
connection into separate Try Catch block and see if it is opened or not
 
Back
Top