In SQL you can use
在SQL中你可以使用
SELECT * FROM INFORMATION_SCHEMA.TABLES
SELECT * FROM INFORMATION_SCHEMA.TABLES
etc to get information about the database structure. I need to know how to achieve the same thing for an Access database.
等获取有关数据库结构的信息。我需要知道如何为Access数据库实现相同的功能。
2 个解决方案
#1
4
The equivalent operation can be accomplished using
使用可以完成等效操作
OleDbConnection.GetOleDbSchemaTable() method.
see http://support.microsoft.com/kb/309488 for more information
有关更多信息,请参见http://support.microsoft.com/kb/309488
#2
0
In OLEDB it can be accessed as DBSCHEMA_TABLES. Following C++ code demonstrates the retrieval of the tables information from an OLEDB provider:
在OLEDB中,它可以作为DBSCHEMA_TABLES访问。以下C ++代码演示了从OLEDB提供程序检索表信息:
#include <atldb.h>
...
// Standard way of obtaining table node info.
CAccessorRowset<CDynamicAccessor, CBulkRowset> pRS;
pRS.SetRows(100);
CSchemaTables<CSession>* pBogus;
hr = session.CreateSchemaRowset(NULL, 0, NULL, IID_IRowset, 0, NULL, (IUnknown**)&pRS.m_spRowset, pBogus);
if (FAILED(hr))
goto lblError;
hr = pRS.Bind();
if (FAILED(hr))
goto lblError;
hr = pRS.MoveFirst();
if (FAILED(hr))
goto lblError;
while (S_OK == hr)
{
wstring sTableSchema(pRS.GetWCharValue(L"TABLE_SCHEMA"));
wstring sTableName(pRS.GetWCharValue(L"TABLE_NAME"));
wstring sTableType(pRS.GetWCharValue(L"TABLE_TYPE"));
...
hr = pRS.MoveNext();
}
pRS.Close();
#1
4
The equivalent operation can be accomplished using
使用可以完成等效操作
OleDbConnection.GetOleDbSchemaTable() method.
see http://support.microsoft.com/kb/309488 for more information
有关更多信息,请参见http://support.microsoft.com/kb/309488
#2
0
In OLEDB it can be accessed as DBSCHEMA_TABLES. Following C++ code demonstrates the retrieval of the tables information from an OLEDB provider:
在OLEDB中,它可以作为DBSCHEMA_TABLES访问。以下C ++代码演示了从OLEDB提供程序检索表信息:
#include <atldb.h>
...
// Standard way of obtaining table node info.
CAccessorRowset<CDynamicAccessor, CBulkRowset> pRS;
pRS.SetRows(100);
CSchemaTables<CSession>* pBogus;
hr = session.CreateSchemaRowset(NULL, 0, NULL, IID_IRowset, 0, NULL, (IUnknown**)&pRS.m_spRowset, pBogus);
if (FAILED(hr))
goto lblError;
hr = pRS.Bind();
if (FAILED(hr))
goto lblError;
hr = pRS.MoveFirst();
if (FAILED(hr))
goto lblError;
while (S_OK == hr)
{
wstring sTableSchema(pRS.GetWCharValue(L"TABLE_SCHEMA"));
wstring sTableName(pRS.GetWCharValue(L"TABLE_NAME"));
wstring sTableType(pRS.GetWCharValue(L"TABLE_TYPE"));
...
hr = pRS.MoveNext();
}
pRS.Close();