Microsoft KB Archive/236828

= PRB: E_UNEXPECTED Returned from IRowsetChange::DeleteRows Without Releasing ISequentialStream Pointer =

Article ID: 236828

Article Last Modified on 1/6/2004

-

APPLIES TO

 Microsoft OLE DB Provider for SQL Server 7.01 Microsoft OLE DB Provider for SQL Server 7.0 Microsoft OLE DB 2.7, when used with:  Microsoft Visual C++ .NET 2002 Standard Edition

 Microsoft Visual C++ .NET 2003 Standard Edition

 Microsoft Visual C++ 6.0 Enterprise Edition</li></ul>

 Microsoft Visual C++ 6.0 Professional Edition</li></ul>

 Microsoft Visual C++ 6.0 Standard Edition</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q236828

<div class="symptoms_section">

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"

<div class="cause_section">

CAUSE
A pointer to an ISequentialStream interface has been retrieved on the row and has not been released.

<div class="resolution_section">

RESOLUTION
Release all ISequentialStream pointers on the row before you delete the row with IRowsetChange::DeleteRows.

<div class="status_section">

STATUS
This behavior is by design.

<div class="moreinformation_section">

Steps to Reproduce the Behavior
<ol>  Create a table in SQL Server with an image field.

Table Name: DemoTab
</li>  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) Note In Visual C++ .NET, the wizard generates code for using the ISequentialStream object in comments. If you want to use this object, you must uncomment these lines in the generated code. The accessor class will be similar to the following: BLOB_ENTRY_LENGTH_STATUS(2, IID_ISequentialStream, STGM_READ, m_field2, m_dwfield2Length, m_dwfield2Status) </li>  Using the new CCommand derived class, add the following: HRESULT hr; CMyCommand rs; rs.Open; rs.MoveNext;<BR/> // rs.m_field2->Release; //un-comment these two lines to fix the error //rs.m_field2 = NULL; hr = rs.Delete; You will notice that E_UNEXPECTED is returned from the Delete call. </li></ol>

Keywords: kbprovider kbdatabase kbprb kbdtl KB236828

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.