Stored Proc and SqlCommand Timeout?

My instinct said that the procedure would still execute so I threw together a simple test.

My instinct said that the procedure would still execute so I threw together a simple test. SQL: Create Procedure TestDelay AS waitfor delay '00:00:40' update table_1 set dt = getdate() And in VB. Net (same as C# for this purpose): Dim con As New SqlConnection(myconnectionstring) Dim com As New SqlCommand("TestDelay", con) com.

CommandType = CommandType. StoredProcedure con.Open() Try com.ExecuteNonQuery() Catch ex As Exception con.Close() Response. Write(ex.

Message) End Try The result? The procedure did not complete after the timeout. I checked what was happening during a trace in SQL profiler and sure enough SQL appears to wrap the call in a transaction and must roll that transaction back on the timeout.

Note: This test was run against SQL 2005 but I'd suspect the results to be similar in other versions.

Correct, at least back to SQL 7 – gbn Nov 11 '09 at 19:53.

As brendan stated, the client sends an "abort" and processing stops dead. As simple as that. However, it's more complex than that... Any transactions are not rolled back by default and locks are just left there until the connection is closed.

If returned to the connection pool and reused, then this does not count as closing. This is why SET XACT_ABORT ON (other questions SO1, SO2) is recommended.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions