Ok, this is a really weird problem. I've got an application that I'm building that inserts records one at a time into a remote MS SQL database. I built error handling into the application so that when an error occurs it will log it in a text file and throw the text file into a directory on my computer.
So here is my problem: When I run my application in debug mode, once I stop it, it keeps on pumping out Insert statements and throwing them at the database. After I've shut the application down, there are still rows being inserted into the database and still error files being logged in the Error log. The only way I can stop it is by restarting my computer.
I tried to run the application and put a break point in, when the application hit the break point it stopped executing the input statements. But as soon as I hit the stop button that is supposed to shut down the application, the insert statements started right back up again filling the table with rows and the error log with errors.
I don't understand why this is happening. I've built a method as a wrapper for for SQLCommand. All I do is pass it the SQL and it opens the connection, runs the command, and closes the connection. I've got it all in a try catch finally block with the close connection in the finally block. So it should always close. When I stop the application from running it is always when it has hit a breakpoint outside of the SQLCommand method, so no connection should even be open.
Can anyone tell me why this is happening, and more importantly how to stop it from occuring? Thanks.
Start Free Trial