Closing a connection BEFORe command execution has completed

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

What happens in the above scenario? Does the query still continue executing
on the Databas server or is it immmediately terminated and resources released
(including locks).

If this is not recommended, then what is the recommended approach for
terminating command's execution.

Thanks in advance
 
Actually, closing the connection with Connection.Close does not close the
connection--it simply releases it back to the pool so the engine will
continue to fill the cache--but it's not that large so the operation might
simply hang resources on the server until the connection is reused.

The problem is, since all of the (normal) Execute methods are synchronous,
there is no way to interrupt the query or action command process. The
solution you seek can only be accomplished by running the query
asynchronously. While waiting for the query to complete you can execute
Command.Cancel. Because of the way TDS and SQL Server responds to cancel
requests your operation might not be immediately "stoppable"--SQL Server
might have some cleanup to do before releasing control and resources.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
 
Thanks Bill

Your suggestion is supported for SQL Server; unfortunately, I am using
Oracle and the OracleCommand does not (even the ODP one) does not support
asynch calls.

Do you have any other suggestions please?
 
Sorry, no. I don't use, support or have any inside knowledge about Oracle.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant, Dad, Grandpa
Microsoft MVP
INETA Speaker
www.betav.com
www.betav.com/blog/billva
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
 
Back
Top