4,011
社区成员
发帖
与我相关
我的任务
分享
使用ADOX::CatalogPtr来创建mdb文件:
HRESULT hr = S_OK;
//Set ActiveConnection of Catalog to this string
CString strcnn(_T("Provider=Microsoft.JET.OLEDB.4.0;Data source = d: est.mdb"));
try
{
ADOX::_CatalogPtr m_pCatalog = NULL;
hr = m_pCatalog.CreateInstance(__uuidof (ADOX::Catalog));
if(FAILED(hr))
{
_com_issue_error(hr);
}
else
{
m_pCatalog->Create(_bstr_t(strcnn)); //Create MDB
}
}
catch(_com_error &e)
{
// Notify the user of errors if any.
AfxMessageBox(_T(“error“));
}
}