DOCUMENT:Q236828 23-AUG-2001 [visualc] TITLE :PRB: IE_UNEXPECTED Returned from IRowsetChange::DeleteRows PRODUCT :Microsoft C Compiler PROD/VER::6.0,7.0,7.01 OPER/SYS: KEYWORDS:kbATL kbDatabase kbDTL kbOLEDB kbProvider kbVC600 kbATL300 kbSQLServ700 kbGrpDSVCDB kbG ====================================================================== ------------------------------------------------------------------------------- The information in this article applies to: - Microsoft OLE DB Provider for SQL Server, versions 7.0, 7.01 - Microsoft OLE DB, used with: - Microsoft Visual C++, 32-bit Enterprise Edition, version 6.0 - Microsoft Visual C++, 32-bit Professional Edition, version 6.0 - Microsoft Visual C++, 32-bit Learning Edition, version 6.0 ------------------------------------------------------------------------------- SYMPTOMS ======== When you use the Microsoft SQL Server OLE DB provider (SQLOLEDB), the following error is returned from IRowsetChange::DeleteRows(): HRESULT = E_UNEXPECTED Description = "Catastrophic error" CAUSE ===== A pointer to an ISequentialStream interface has been retrieved on the row and has not been released. RESOLUTION ========== Release all ISequentialStream pointers on the row before deleting the row with IRowsetChange::DeleteRows. STATUS ====== This behavior is by design. MORE INFORMATION ================ Steps to Reproduce this Behavior -------------------------------- 1. Create a table in SQL Server with an image field. 2. Use the Active Template Library (ATL) OLE DB Consumer Wizard to create a CCommand class that will be used to open up a rowset on the table. The wizard will generate code similar to the following in the accessor class: BLOB_ENTRY(2, IID_ISequentialStream, STGM_READ, m_field2) 3. Using the new CCommand derived class, add the following: HRESULT hr; CMyCommand rs; rs.Open(); rs.MoveNext();
// rs.m_field2->Release(); //un-comment this line to fix the error hr = rs.Delete(); You will notice that E_UNEXPECTED is returned from the Delete() call. Additional query words: ====================================================================== Keywords : kbATL kbDatabase kbDTL kbOLEDB kbProvider kbVC600 kbATL300 kbSQLServ700 kbGrpDSVCDB kbGrpDSMDAC kbDSupport kbMDAC250 kbMDAC260 Technology : kbSQLServSearch kbAudDeveloper kbOLEDBSearch kbOLEDBProvSearch Version : :6.0,7.0,7.01 Issue type : kbprb ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 2001.