Microsoft Knowledge Base Email Alertz

KBAlertz.com: (236828) - 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

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]

Search KbAlertz

Advanced Search

Webmasters
Put kbAlertz on your website.
[ Click Here for more! ]





ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
KBAlertz referrals get
** SIX MONTHS FREE **


Community Site



We Send hundreds of thousands of emails using ASP.NET Email


ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
KBAlertz referrals get
** SIX MONTHS FREE **




Mentioned In








Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks




Article ID: 236828 - Last Review: January 6, 2004 - Revision: 3.0

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

This article was previously published under Q236828

On This Page

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 you delete the row with IRowsetChange::DeleteRows.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Create a table in SQL Server with an image field.

    Table Name: DemoTab

    Collapse this tableExpand this table
    Field Name Data Type
    field1int
    field2image
  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)
    					
    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)
    					
  3. 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.

APPLIES TO
  • Microsoft OLE DB Provider for SQL Server 7.01
  • 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
    • Microsoft Visual C++ 6.0 Professional Edition
    • Microsoft Visual C++, 32-bit Learning Edition 6.0
Keywords: 
kbprovider kbdatabase kbprb kbdtl KB236828
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate

Be the first to leave feedback, to help others about this knowledge base article.

(Optional) Name

(Optional) Public URL Or Email

Comments
No HTML -- Text Only Please