Today, I would like to share with you an important recommendation about command execution error handling that applies for all the software languages.
I developed a C# application that will run around 200 TSQL operations. This TSQL operation basically takes around 10 seconds but the command timeout execution will be 5 seconds, causing a command execution timeout.
In every operation, I'm going to open a new connection and in my error handling I'm not going to close the connection. The situation that we are going to have will be that after reaching the limit, for example, the default value of my connection pooling, I'm going to have an error mentioning that I'm not able to connect however, using other tools I will be able to.
So, for this reason, It is important that everytime that you're trying to execute a query, please, consider to close the connection to avoid a possible issue with your connections.
Enjoy!