Timeout when executing SQL

mbrande

Member
Joined
Apr 15, 2010
Messages
12
Programming Experience
10+
I am getting this error message:

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

I receive it randomly when trying to execute a delete statement within Visual Studio 2005. The connection timeout has been set to 0 and the command timeout has been set to 0 through the use of a partial class. We are using SQL Server 2005.
 
Set the command timeout parm

Use this:

cmd.CommandText = "DELETE FROM ...
cmd.CommandTimeout = 240
Try
RowsDeleted = cmd.ExecuteNonQuery
Catch ex As Exception
 
We were using the Table Adapter and using Partial Classes to extend the TA to be able to set the Command Timeouts. The property is set to 0. I can try changing it to 240. But I had thought 0 was infinite.
 
Back
Top