uberamd
Member
- Joined
- Jan 22, 2007
- Messages
- 9
- Programming Experience
- Beginner
I have a console application that every 10 minutes opens a connection to a mysql db, opens a file stream writer, modifies the db, modifies a log file, closes both the mysql connection and file stream, and pauses for 10 minutes before going at it again. Thats all working as intended.
However, the application can be closed say while the mysql connection and file stream reader is open, which I don't want. Is there a way to catch when the user tries to close the application and have it call a function that will do conn.Close() and s.Close() before exiting so i am not leaving those open?
However, the application can be closed say while the mysql connection and file stream reader is open, which I don't want. Is there a way to catch when the user tries to close the application and have it call a function that will do conn.Close() and s.Close() before exiting so i am not leaving those open?