日期:2014-05-17  浏览次数:20895 次

这个异常是怎么回事
int iCount=m_Recordset->Fields->GetCount();
while (!m_Recordset->adoEOF ) 
{
CString strToFile,value;
if(sFilePrefix.Compare("ProFlow")==0 || sFilePrefix.Compare("Proroute")==0)
strToFile=",";
for(int i=0;i<iCount;i++)
{
VARIANT vt;
Field * pf = m_Recordset->GetFields()->GetItem((long)i);  //这里程序会异常
pf->get_Value(&vt);
if(vt.vt==VT_NULL)
value = "";
else
value=((BSTR)_bstr_t(vt));
value.TrimLeft();
value.TrimRight();
strToFile += value;
strToFile += ",";
}
fprintf(fp, strToFile.GetBuffer());
fprintf(fp, "\n");

//取下一条记录
m_Recordset->MoveNext();
}
------最佳解决方案--------------------
什么异常呢?