Restart SQL Server

S

Steve

Is it possible to detect or more importantly allow the app to continue to
work with sql server after it has been restarted.

I imagine my users to have this app open all day but don't want them all to
restart the app if the server is restarted.

At the moment the situation is:-

* SQL server ok, App works.
* Sql Server stopped - App doesn't work (as expected) with error
handling leaving the app in a try again later state so they don't lose the
data entered on the current form.
* Sql Server Restarted - app still doesn't work! I'd like it to just
reconnect to stop me from getting punched by angry users!

Thanks in advance for any ideas.

Steve.
 
S

Steve

No worries, I just call the Dispose on the connection object. Set a flag
on sql server errors, then next time an sql action is required I recreate
the connection. Codes a bit scrappy but the general idea should work. I
think.

Steve.
 
R

Robbe Morris [C# MVP]

Yes, you should be closing the connection immediately after
ever call. Leaving a single connection open and reused
for the app is not recommended unless the connection
time to your sql server is incredibly slow due to
network issues.

--
Robbe Morris - 2004/2005 Microsoft MVP C#
http://www.eggheadcafe.com/forums/merit.asp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top