使用查看所有表名语句:
select name from MSysObjects where type=1 and flags=0
并不成功,用GetLastError();查看是没有权限问题:
网上有修改mdb权限的方法,不过我的Access和一小部分网友一样,找不到【工具】这一栏
后面找到另一种方式:
void GetTableLists(const CString &strPath)
{
_ConnectionPtr m_pConnection;
_RecordsetPtr m_pRecordset;
HRESULT hr;
CStringArray dbtables;
try
{
CoInitialize(NULL);
hr = m_pConnection.CreateInstance(__uuidof(Connection));
hr = m_pRecordset.CreateInstance(__uuidof(Recordset));
if (SUCCEEDED(hr))
{
CString strconnection;
strconnection.Format(_T("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s"), strPath);
//12.0驱动使用st