The information in this article applies to:
SYMPTOMSWhen you open a dynaset or dynamic recordset that contains an image field and that connects to a SQL Server datasource by way of the 2.65.0201 driver that ships with SQL Server 6.5, you may observe an exception thrown indicating:
CAUSEThe MFC database classes are designed to adhere to the ODBC specification. The grammar for the specification contains a error that indicates that all compliant drivers must support the appearance of 'FOR UPDATE OF' in SELECT statements. In reality, the specification grammar (available in the ODBC Programmer's Reference in Visual C++ Books Online) should make support of the 'OF' keyword optional:
The MFC database classes, per the error in the specification, use the 'FOR
UPDATE OF' syntax. Generally, this does not cause a problem for the
following reasons:
RESOLUTION32 bitWhile it might seem logical to simply override the function CRecordset::ValidateSelectForUpdateSupport() so that it informs MFC that the 2.65.0210 driver does not support FOR UPDATE OF, this is not easily done because that function is not virtual.Instead, you can override CRecordset::OnSetOptions() and, following the call to the base class, reset the value of m_dwDriverPositionedStatements to clear the bit that corresponds to SQL_PS_SELECT_FOR_UPDATE:
This causes MFC to not append the FOR UPDATE OF, which avoids the syntax
error without reducing the functionality of the recordset.
16 bitIf you are using dynasets by way of the DYNSET sample code in 16-bit Visual C, your application actually contains the code that appends the FOR UPDATE OF, so you can simply modify the Dynacore.cpp file to remove the OF from the szForUpdateOf string.STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem was corrected in Visual C++ version 4.2. REFERENCESODBC Programmer's Reference, Appendix C: SQL Grammar Additional query words: kbVC400bug BLOB CLongBinary
Keywords : kbDatabase kbMFC kbODBC kbVC kbVC420fix |
Last Reviewed: August 2, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |