18,356
社区成员
发帖
与我相关
我的任务
分享
0x011272EE 处有未经处理的异常(在 PiggyIOCPServer.exe 中): 0xC0000005: 读取位置 0x6A4A5754 时发生访问冲突。
m_pRecordset->Open((_bstr_t)strTemp1, m_pConnection.GetInterfacePtr(), adOpenStatic, adLockOptimistic, adCmdText);
int recordCount = 0;
recordCount = m_pRecordset->GetRecordCount();
string intStr;
if (recordCount > 0){
m_pRecordset->MoveFirst();///移到首条记录
}
for (int i = 0; i < recordCount; i++){
_variant_t vtName, vtLabel, vtRawMin, vtRawMax, vtEngMin, vtRangeEngMax;
vtName = m_pRecordset->GetCollect("name");
vtLabel = m_pRecordset->GetCollect("label");
vtRawMin = m_pRecordset->GetCollect("rawMin");
vtRawMax = m_pRecordset->GetCollect("rawMax");
vtEngMin = m_pRecordset->GetCollect("engMin");
vtRangeEngMax = m_pRecordset->GetCollect("engMax");
//memset((char*)info[i]->field.c_str(), 0, sizeof(info[i]->field));
info[i]->name = (char*)(_bstr_t)vtName;
info[i]->label = (char*)(_bstr_t)vtLabel;
info[i]->rawMin = atoi((char*)(_bstr_t)vtRawMin);
info[i]->rawMax = atoi((char*)(_bstr_t)vtRawMax);
info[i]->engMin = atoi((char*)(_bstr_t)vtEngMin);
info[i]->engMax = atoi((char*)(_bstr_t)vtRangeEngMax);
dataInfos.push_back(info[i]);
//插入到界面
m_ctlListDataEnable.InsertItem(i, info[i]->name.c_str());
m_ctlListDataEnable.SetItemText(i, 1, info[i]->label.c_str());
itoa(info[i]->rawMin, (char*)intStr.c_str(), 10);
m_ctlListDataEnable.SetItemText(i, 2, intStr.c_str());
itoa(info[i]->rawMax, (char*)intStr.c_str(), 10);
m_ctlListDataEnable.SetItemText(i, 3, intStr.c_str());
itoa(info[i]->engMin, (char*)intStr.c_str(), 10);
m_ctlListDataEnable.SetItemText(i, 4, intStr.c_str());
itoa(info[i]->engMax, (char*)intStr.c_str(), 10);
m_ctlListDataEnable.SetItemText(i, 5, intStr.c_str());
m_pRecordset->MoveNext();
}
m_pRecordset->Close();
加载,插入,删除都没有问题,数据进数据库的,就是数据集关闭后抛出异常