导入数据时可以读取第一行数据并导入成功,读取第二行后不能导入。
代码如下:
CString strSQL("insert into test(i_name, j_name) values(");
while (!pRecordset->EndOfFile)
{
CString strId;
strId.Format("%s",(const char *)(_bstr_t)(pRecordset->GetCollect("i")));
strSQL += "'";
strSQL += strId;
strSQL += "'";
strSQL += ",";
strSQL += "'";
CString strTT;
strTT.Format("%s",(const char *)(_bstr_t)(pRecordset->GetCollect("j")));
strSQL += strTT;
strSQL += "'";
strSQL += ")";
_bstr_t temp = strSQL;
pRecordsetFox->Open(temp,m_pConnFox.GetInterfacePtr(),adOpenDynamic,adLockOptimistic,adCmdText);// 取得表中的记录
pRecordset->MoveNext(); ///移到下一条记录
row++;
}