BUG: SQLState S1011 on SQL_AUTOCOMMIT_OFF with Active Results (149918)



The information in this article applies to:

  • Microsoft Open Database Connectivity

This article was previously published under Q149918
Bug#: 1686 (2.00)

SYMPTOMS

If an application does the following in the Microsoft Access 2.0 or 3.0 version ODBC drivers:
   SQLExecDirect(hstmt, "select * from any_table", SQL_NTS);
   SQLFetch(hstmt);
   SQLSetConnectOption(hstmt, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF);
				
The error generated is:
szSqlState = "S1011", *pfNativeError = 59, *pcbErrorMsg = 76 szErrorMsg="[Microsoft][ODBC Microsoft Access 7.0 Driver]Operation invalid at this time."

CAUSE

The Access ODBC driver generates an S1011 error if an attempt is made to turn off the ODBC autocommit connection option while a result set is active.

WORKAROUND

Either set the autocommit option before opening the result set, or close the result set before issuing the SQLSetConnectOption command.

STATUS

Microsoft has confirmed this to be a problem with the ODBC Access 2.00.2317 driver. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

Modification Type:MajorLast Reviewed:7/27/2001
Keywords:kbBug KB149918