sqlcommand.BeginExecuteReader ignores CommandTimeout

sqlcommand.BeginExecuteReader ignores CommandTimeout

am 08.11.2007 19:41:01 von dave

The following finishes in 1 hour instead of erroring after 1 second as
expected.

Dim cn As New System.Data.SqlClient.SqlConnection
cn.ConnectionString = "Server=(local); Database=master; User ID=sa;
Password=passwd; Asynchronous Processing=true;"
cn.Open()

Dim sqlcommand As New System.Data.SqlClient.SqlCommand
sqlcommand.Connection = cn
sqlcommand.CommandTimeout = 1
sqlcommand.CommandText = "waitfor delay '01:00:00'"
Dim iasyncresult As System.IAsyncResult =
sqlcommand.BeginExecuteReader()
While Not iasyncresult.IsCompleted
System.Threading.Thread.Sleep(1000)
End While

'Note: the following correctly errors after 1 second
'sqlcommand.ExecuteReader()