DBPROP_IRowsetChange and ORDER BY mutually exclusive?
Vedran Brnicevic <[email protected]> Wed, 31 Jul 2002 07:37:32 -0700
| Newsgroups | gmane.comp.windows.devel.oledb.devel |
|---|---|
| Message-ID | <OLEDB_DEV%[email protected]> |
Hi guys,
here'e the situation:
I'm using CCommand<CDynAccessor> template to access SQLServer 2000 through
MDAC 2.7 version of OLEDB provider for SQLServer.
Following code fragment works fine:
CCommand<CDynAccessor>::Create((CSession&)(*m_pDB), "SELECT * FROM
UserTable");
CDBPropSet propset(DBPROPSET_ROWSET);
propset.AddProperty(DBPROP_IRowsetChange, true);
propset.AddProperty(DBPROP_UPDATABILITY,(long)
(DBPROPVAL_UP_CHANGE | DBPROPVAL_UP_INSERT | DBPROPVAL_UP_DELETE));
propset.AddProperty(DBPROP_CANFETCHBACKWARDS, true);
HRESULT hr = CCommand<CDynAccessor>::Open(&propset);
hr is S_OK, I can navigate forward and backward and update records in the
rowset.
However, if i change the query by adding the ORDER BY clause ("SELECT *
FROM UserTable ORDER BY field1") method
HRESULT hr = CCommand<CDynAccessor>::Open(&propset);
fails with the DB_E_ERORSOCCURED error message.
If I then remove the support for updatable rowsets (DBPROP_IRowsetChange),
everything works fine again.
It looks like those two things are mutually exclusive. I checked the SQL
Server Books online and found in chapter "Rowsets and SQL Server Cursors"
there is a table showing that the
IRowsetChange interface should work "in harmony" with the ORDER BY clause.
Am I missing smth there?
Vedran
You can read messages from the OLEDB_DEV archive, unsubscribe from OLEDB_DEV,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.