Click here to Skip to main content
15,885,767 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a windows service ,when i disconnect the sql server service got an exception in my catch{} block and application got terminate execution.How can i handle that exception without terminating the application
Got an exception like this

DAB.ExecuteScalar->DAB.PrepareCommand->A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
how can i overcome this exception without terminating the application ??
Posted
Updated 16-Dec-14 18:15pm
v3
Comments
ZurdoDev 15-Dec-14 9:16am    
Why did it terminate? If you caught it, you should be able to do what you need to.
Tejas Vaishnav 15-Dec-14 9:17am    
And what exception your got? can you add more detail in your question by using improve question link.
Tejas Vaishnav 17-Dec-14 5:45am    
You exception message shows every thing, when your are trying to disconnect, at that time your sql server is not accessible that's the reason you got this error. so please check your connection string, and if possible please paste your code too.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900