我是用ado连接数据库,实现的功能是对俩个表中的俩个字段进行比较,根据比较结果,然后写入到第二个表中,但是一直出现runtim error,小弟是菜鸟,想请各位指教一下谢谢了void CMyADODlg::OnButton2() 
{
// TODO: Add your control notification handler code here
_variant_t ra,rb;
RawLog=theApp.m_strgcon->Execute("select * from inetlog",&ra,adCmdText); RawLog->MoveFirst();
UserFile=theApp.m_strgcon->Execute("select * from userfile",&rb,adCmdText);
UserFile->MoveFirst();

while(!RawLog->adoEOF)
{

_variant_t ClientHost1,machine1;
ClientHost1=RawLog->GetCollect("ClientHost");
machine1=RawLog->GetCollect("machine");

while(!UserFile->adoEOF)
{

_variant_t ClientHost2,machine2;
ClientHost2=UserFile->GetCollect("ClientHost");
machine2=UserFile->GetCollect("machine");

   if(!(strcmp((LPCTSTR)(_bstr_t)ClientHost1,(LPCTSTR)(_bstr_t)ClientHost2)&& strcmp((LPCTSTR)(_bstr_t)machine1,(LPCTSTR)(_bstr_t)machine2) ))

{

把表RawLog中的数据插入表UserFile



UserFile->MoveNext();
}
else
{
把表RawLog中的数据插入表UserFile
}

}
RawLog->MoveNext();
}

}