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...