I have built a C# desktop application, its database is online. Some times because of internet it becomes disconnected and as a result if user saves a form, an error of db disconnection occurs and it get closed and exits. This is quite horrible.
Is there an option that I can apply try catches every where in the code, but the issue is, application is so big that it will become a headache, connection string is one, but connections made are many, can I apply some configuration like that, if database is closed it should not be halt and exit, what is the easiest solution.
Thanks
Atif
Fastest solution is implement try catch in your program.cs method Main()
Best solution is to refactor your software, search for all connections using search in VS and replace it with new logic. For Example
and handle all errors inside.