偶的下列代码在装有VC环境下运行良好(程序采用静态库连接),但在无VC环境的机器上却提示错误断点:daocore.cpp第534行.
代码如下:
CDaoDatabase db;
db.Create("c:\\dtt.mdb");
db.Close();
就是在无VC环境的机器上装上msdac2.8都不行啊,到底是哪里错了啊
代码如下:
CDaoDatabase db;
db.Create("c:\\dtt.mdb");
db.Close();
就是在无VC环境的机器上装上msdac2.8都不行啊,到底是哪里错了啊
stdafx.h 文件中:
#import "c:\Program files\Common files\system\ado\msadox.dll" no_namespace 创建文件代码:
HRESULT hr = S_OK;
CoInitialize(NULL);
// Define ADOX object pointers.
// Initialize pointers on define.
// These are in the ADOX:: namespace.
_CatalogPtr m_pCatalog = NULL;
//Set ActiveConnection of Catalog to this string
_bstr_t strcnn("Provider='Microsoft.Jet.OLEDB.4.0';Data source = c:\\tanyizhi.mdb");
try
{
hr = m_pCatalog.CreateInstance(__uuidof(Catalog));
m_pCatalog->Create(strcnn);
AfxMessageBox("Database 'c:\\tanyizhi.mdb' is created.\n");
}
catch(_com_error &e)
{
// Notify the user of errors if any.
_bstr_t bstrSource(e.Source());
_bstr_t bstrDescription(e.Description());
AfxMessageBox((LPCSTR)bstrSource);
AfxMessageBox((LPCSTR)bstrDescription);
}
catch(...)
{
AfxMessageBox("error");
}
CoUninitialize();
和#import "c:\Program files\Common files\system\ado\msadox.dll" no_namespace 里面提到了结构和接口函数重复定义但又都要用到它们的智能指针,怎么办呀
#import "c:\program files\common files\system\ado\msado20.tlb"