Partager via


CDaoDatabase::SetQueryTimeout

Call this member function to override the default number of seconds to allow before subsequent operations on the connected database time out.

void SetQueryTimeout( 
   short nSeconds  
);

Parameters

  • nSeconds
    The number of seconds to allow before a query attempt times out.

Remarks

An operation might time out because of network access problems, excessive query processing time, and so on. Call SetQueryTimeout before opening your recordset or before calling the recordset's AddNew, Update, or Delete member functions if you want to change the query timeout value. The setting affects all subsequent Open, AddNew, Update, and Delete calls to any recordsets associated with this CDaoDatabase object. Changing the query timeout value for a recordset after opening does not change the value for the recordset. For example, subsequent Move operations do not use the new value.

The default value for query timeouts is 60 seconds. Not all databases support the ability to set a query timeout value. If you set a query timeout value of 0, no timeout occurs; the communication with the database may stop responding. This behavior may be useful during development.

For related information, see the topic "QueryTimeout Property" in DAO Help.

Requirements

Header: afxdao.h

See Also

Reference

CDaoDatabase Class

Hierarchy Chart

CDaoWorkspace::SetLoginTimeout