VC使用Access插入速度慢,如何提升Access读写效率?
绿色盒子 2018-05-24 10:47:05 [b]插入代码如下,使用for循环插入大概20000多条信息,用了十几秒,Access数据库插入这么慢吗,有没有办法提升速度[/b]
BOOL InsertTable(CString sqlCmd)
{
try
{
_variant_t RecordsAffected;
m_pCommand.CreateInstance(__uuidof(Command));
m_pCommand->ActiveConnection = m_pConnection;
m_pCommand->CommandText =(_bstr_t)sqlCmd;
m_pCommand->Execute(NULL, NULL, adCmdText);
//m_pConnection->Execute((_bstr_t)sqlCmd, &RecordsAffected, adCmdText);
}
catch (_com_error* e)
{
AfxMessageBox(e->ErrorMessage());
return FALSE;
}
return TRUE;
}