CDaoDatabase::SetQueryTimeout

void SetQueryTimeout( short nSeconds );
throw( CDaoException, CMemoryException );

Parameters

nSeconds

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

Remarks

Call this member function to override the default number of seconds to allow before subsequent operations on the connected database time out. An operation might time out due to network access problems, excessive query processing time, and so on. Call SetQueryTimeout prior to opening your recordset or prior to 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 hang. This behavior may be useful during development.

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

CDaoDatabase OverviewClass MembersHierarchy Chart

See Also   CDaoWorkspace::SetLoginTimeout