PRB: DB_E_ERRORSOCCURRED returned from Open when using GROUP BY and Aggregate function (236933)
The information in this article applies to:
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++ .NET (2002)
This article was previously published under Q236933 SYMPTOMS When using the Microsoft SQL Server OLE DB Provider
(SQLOLEDB) with OLE DB template consumer classes to open a rowset with a SQL
query that contains GROUP BY and aggregate functions such as MAX, you might receive a DB_E_ERRORSOCCURRED error from the Open call.
CAUSE You have marked the rowset for change, insert, or delete
when using the ATL Consumer Wizard or have added properties to make the rowset
updateable. RESOLUTION Do not mark the rowset for change, insert, or delete when
the command contains an aggregate function. You can comment out the following
lines in your ATL code:
propset.AddProperty(DBPROP_IRowsetChange, true);
propset.AddProperty(DBPROP_UPDATABILITY, DBPROPVAL_UP_CHANGE | DBPROPVAL_UP_INSERT | DBPROPVAL_UP_DELETE);
STATUS
This behavior is by design. If a SELECT statement contains an aggregate function, such as MAX, a server-side cursor is automatically opened with a scroll
option of CUR_INSENSITIVE and a concuropt of CUR_READONLY that is not
updateable. For additional information, search for "dbcursoropen" in SQL
Server 7.0 Books Online.
Modification Type: | Major | Last Reviewed: | 3/19/2004 |
---|
Keywords: | kbATL300 kbDatabase kbDTL kbGrpDSVCDB kbOLEDB kbprb kbSQLServ KB236933 kbAudDeveloper |
---|
|