HRESULT hr;
hr = m_pConnection.CreateInstance("ADODB.Connection");
hr = m_pConnection->Open((_bstr_t)CInputXlDlg::m_strCnn,"","",adModeUnknown);///连接数据库
//以上我用了try-catch块,这里省略了,看得清楚一点。
CString strSQL;
strSQL.Format("select * into [a] in 'G:\\UMTSimu.mdb' from [b]");
try{
m_pRst->Open((_variant_t)strSQL,_variant_t((IDispatch*)m_pConnection,true),adOpenKeyset,adLockPessimistic,adCmdText);
m_pRst->Close();
}
catch(_com_error e)
{}
只好这样防止出错了。
有同表名的,没不会覆盖。