| 
PRB: E_UNEXPECTED Returned from IRowsetChange::DeleteRows Without Releasing ISequentialStream Pointer
ID: Q236828
 
 | 
The information in this article applies to:
- 
Microsoft Visual C++, 32-bit Editions, version  6.0
- 
Microsoft OLE DB Provider for SQL Server, version  7.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
- Create a table in SQL Server with an image field.
- 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) 
 
- Using the new CCommand derived class, add the following:
 
   HRESULT hr;
   CMyCommand rs;
   rs.Open();
   rs.MoveNext();<BR/>
// 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          : kbDatabase kbDTL kbOLEDB kbVC600 kbATL300 kbSQLServ700 kbGrpVCDB 
Version           : WINDOWS:7.0; winnt:6.0
Platform          : WINDOWS winnt 
Issue type        : kbprb