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
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"
A pointer to an ISequentialStream interface has been
retrieved on the row and has not been released.
Release all ISequentialStream pointers on the row before
you delete the row with
IRowsetChange::DeleteRows.
This behavior is by design.
Steps to Reproduce the Behavior
- Create a table in SQL Server with an image field.
Table
Name: DemoTab
Collapse this tableExpand this table
| Field Name | Data Type |
| field1 | int |
| field2 | image |
- 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)
- 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
| 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