How to determine if MyConnection busy
Posted: Fri 07 Sep 2018 07:20
I am very surprised no one have asked this question yet. How do I know if MyConnection is currently busy?
My application needs MyConnection to ping to the server to keep the connection alive, so I set up a timer for this. While another part of my application needs to request data from the server for for a lengthy period, using Ping command in the middle of this process causes exceptions like "net packet out of order" or "SQL statement doesn't return rows".
I understand that one MyConnection cannot run multiple commands/threads at the same time, but I don't know how to determine if the MyConnection is busy so I can prevent this problem.
My application needs MyConnection to ping to the server to keep the connection alive, so I set up a timer for this. While another part of my application needs to request data from the server for for a lengthy period, using Ping command in the middle of this process causes exceptions like "net packet out of order" or "SQL statement doesn't return rows".
I understand that one MyConnection cannot run multiple commands/threads at the same time, but I don't know how to determine if the MyConnection is busy so I can prevent this problem.