Quantcast
Viewing all articles
Browse latest Browse all 15889

Microsoft OLE DB Provider for SQL Server cannot get all the schemas?

I use MS SQL Server 2008 for Database Development.

Now, I need to get all the tables in SQL Server via OLE DB For SQL Server. However, after querying, only one system table called sysallocunits is returned in the rowset. Some fragments of source codes are shown at the end of this article.

I guess it is the driver which causes this issue, because the results prove to be right when using OLE DB Provider for ODBC.

I am confused about it for days.

Anybody can help me?

Thanks.

Fragments:

IDBCreateSession*       pCreateSession;
//...
IUnknown*               pUnkSession = NULL;
pCreateSession->CreateSession(
  NULL,                           // pUnkOuter
  IID_IOpenRowset,                // riid&pUnkSession                    // ppSession
                            );
IDBSchemaRowset*        pIDBSchemaRowset = NULL;
pUnkSession->QueryInterface (IID_IDBSchemaRowset, (void**) &pIDBSchemaRowset);
pIDBSchemaRowset->GetRowset(
  NULL,               // pUnkOuter
  DBSCHEMA_TABLES,     // guidSchema
  0,                  // cRestrictions
  NULL,               // rgRestrictions
  IID_IRowset,        // riid
  0,
  NULL,&pUnkRowset         // ppRowset
                            );
IRowset* pRowset;
pUnkRowset->QueryInterface(IID_IRowset, (void**&pRowset);
// the later codes are getting data through pRowset->GetNextRows...


Viewing all articles
Browse latest Browse all 15889

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>