ADO.NET Connection and Command Timeout

Provided by Dave Juth, Senior Systems Architect

The SqlConnection and SqlCommand objects each have a property to set a timeout value (ConnectionTimeout and CommandTimeout, respectively). You should note that the SqlConnection.ConnectionTimeout is the time allowed to establish a connection, and the SqlCommand.CommandTimeout is the time allowed to return data from a query or complete a data operation. The connection object's timeout is sometimes mistaken as a way to control how long an application waits for a query result, which is not the case and can be a "gotcha" for developers.

If you use older versions of the Microsoft Enterprise Library's Data Access Application Block, you cannot set a timeout value for a command object directly. This is another thing to be aware of when creating a database application with relatively complex queries or large amounts of data.


Additional Resources

 

 

Thank you! Thank you! I just finished reading this document, which was part of a link in the recent Buzz newsletter. I have printed it for others to read, especially those skeptical on the powers of Access and its capabilities.

Darren D.


View all FMS products for Microsoft Access All Our Microsoft Access Products

 

 

Free Product Catalog from FMS