path=new CString[number];
picinfo=new CString[number];sql="SELECT PicRecord FROM MedicalRecord where RecordID='"+RecordId+"'";
pCmd->CommandText=_bstr_t(sql);//
pRs=pCmd->Execute(NULL,NULL,adCmdText);//for(m=0;m<number;m++)
{
path[m] = (LPCSTR)_bstr_t(pRs->GetCollect("PicRecord"));
pRs->MoveNext();
}pRs->MoveFirst();sql="SELECT PicInfomation FROM MedicalRecord where RecordID='"+RecordId+"'";
pCmd->CommandText=_bstr_t(sql);//
pRs=pCmd->Execute(NULL,NULL,adCmdText);//******************for(m=0;m<number;m++)
{
picinfo[m] = (LPCSTR)_bstr_t(pRs->GetCollect("PicInformation"));
pRs->MoveNext();
}这是一段代码,定义两个数组,根据RecordId找出PicRecord和PicInformation分别放到两个数组里,就报错了
说什么unhandled exception 我设置断点显示是****那句到那里执行不下去了,求高手!!怎么回事!!!

解决方案 »

  1.   

    查询一次就可以了。
    path=new CString[number];
    picinfo=new CString[number];sql="SELECT PicRecord,PicInfomation FROM MedicalRecord where RecordID='"+RecordId+"'"; 
    pCmd->CommandText=_bstr_t(sql);//
    pRs=pCmd->Execute(NULL,NULL,adCmdText);//for(m=0;m<number;m++)
    {
    path[m] = (LPCSTR)_bstr_t(pRs->GetCollect("PicRecord"));
    picinfo[m] = (LPCSTR)_bstr_t(pRs->GetCollect("PicInformation"));
    pRs->MoveNext();
    }