Timeout expired in SqlCommand.ExecuteNonQuery for SQL Server 2005

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<span style="color:#333333; font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif; font-size:13px; line-height:16px I have legendary Timeout error:
<span style="color:#333333; font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif; font-size:13px; line-height:16px
<p style=" Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
<p style=" trace: <br/>
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)<br/>
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)<br/>
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)<br/>
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)<br/>
at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async)<br/>
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)<br/>
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
<p style="
<span><span style="font-size:9.0pt; line-height:115%; font-family:"Segoe UI","sans-serif"; color:#333333 In my C# client application I start transaction, then execute stored procedure with ExecuteNonQuery(), what inserts some records, and after it
completes, I rollback transaction. (Itâs an old code, so donât ask why).
<span><span style="font-size:9.0pt; line-height:115%; font-family:"Segoe UI","sans-serif"; color:#333333 Timeout appear when number of proceeded items is more than 2000 (not a huge amount of data, but still) and procedure executes more than 30 seconds.
I tried everything to avoid rewriting old procedures, so I tried to increase connection timeout in connection string, tried to change connection timout in the application code, tried to increase command timeout â nothing of this helped. I suspect problem
lies in fact, that there is a huge transaction what is rolled back after stored procedure is executed, but I donât<span style="
know how to avoid it with minimal changes in existing functionality.
<span><span style="font-size:9.0pt; line-height:115%; font-family:"Segoe UI","sans-serif"; color:#333333 And of course, like in many cases, problem started to appear after I migrated solution from SQL 2000 to SQL 2005.
<span><span style="font-size:9.0pt; line-height:115%; font-family:"Segoe UI","sans-serif"; color:#333333 So, any bright ideas, except changing timeout property, what seems not working for me?




View the full article
 
Back
Top