Reputation: 17607
Apparently (MSDN) sometimes OleDbConnection.ResetState() does nothing, so even if the connection fails OleDbConnection.State will still be set to Open. I am looking for best workaround for this, so that when I check connection state I can avoid raising exceptions (as long as connection hasn't failed between the last check and usage attempt).
Is there nothing better than sending a "useless" sql statement each time just to see if an exception is thrown? How do you make sure your connection is open before you actually use it?
Upvotes: 9
Views: 5660
Reputation: 6452
In your case I would do the following :
Hope this helps.
Upvotes: 5