A Timeout Occurs While Debugging a Stored Procedure...

Feature Only in Enterprise Edition   This feature is supported only in Visual C++ Enterprise Edition. For more information, see .

Full Error Text: A Timeout Occurs While Debugging a Stored Procedure Called From an MFC Application.

The number of seconds for a query timeout is contained in the member variable m_dwQueryTimeout in CDatabase. This is set in the constructor to the following value from AFXDB.H.

#define DEFAULT_QUERY_TIMEOUT 15

The value of m_dwQueryTimeout is passed to the ODBC API SQLSetStmtOption in the function CDatabase::OnSetOptions.

To resolve the timeout problem, add a call to CDatabase::SetQueryTimeout before your call to CDatabase::ExecuteSQL. For example:

CDatabase db;
db.OpenEx("DSN=MyDSN;UID=sa");
#ifdef _DEBUG
db.SetQueryTimeout(0);   // 0 signifies no timeout
#endif
db.ExecuteSQL("{call mysp}");