Timeout expired. The timeout period elapsed prior to completion...

Problem

You receive this error message when your application attempts to call a stored procedure or other external program:

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

This error occurs when a database query or stored procedure is not able to complete execution before a pre-set timeout period expires.

Solution

Step 1:  Increase the amount of time that ASP.NET waits for the database query to run before throwing an exception.  Programmatically set the CommandTimeout property in the IDbCommand object in a code customization in your application.  IDbCommand is a .NET Framework object.  CommandTimeout specifies the amount of time in seconds that .NET waits for the database query command to execute.  Set that value high enough to exceed the amount of time required to execute your query or database stored procedure.  You may need to adjust this timeout parameter on an application-by-application basis.

C#:

System.Data.IDbCommand.CommandTimeout = 50;

Visual Basic .NET:

System.Data.IDbCommand.CommandTimeout = 50

Step 2:  Increase the amount of time that your database driver waits on your connection.  This is different from the IDbCommand.CommandTimeout property.  Both must be set properly for your query or stored procedure to run.

See Timeout error... for details.

Step 3:  Disable smooth panel update if necessary.  Applications can sometimes time out when the “Smooth panel update” property is set to True.  Setting “Smooth panel update” to False may reduce application timeout in certain circumstances.

See Also

Part IX:  Troubleshooting Applications

Application Will Not Run

Application Runs But No Data is Displayed

Application Error Messages