+ -
当前位置:首页 → 问答吧 → MFC 数据库操作问题

MFC 数据库操作问题

时间:2011-12-03

来源:互联网

m_pRecordset.CreateInstance(__uuidof(Recordset));//创建记录集
CString RTUID,Mobile;
RTUID = meterdata[i].RTUID;
Mobile = meterdata[i].Mobile;
strSQL = "select * from 采集记录 where 子机号 = '"+RTUID+"'and DTU号码 = '"+Mobile+"' and 采集日期 > '"+strtemp1+"' and 采集日期 < '"+strtemp3+"' ORDER BY 采集时间 DESC ";
try
{
m_pRecordset->Open(_variant_t(strSQL),g_pConnection.GetInterfacePtr(),adOpenDynamic,adLockOptimistic,adCmdText);
}
catch(...)
{
AfxMessageBox("GetData()执行SQL语句错误!");
}

  if (m_pRecordset->adoEOF)
{
m_pRecordset->Close();
}
else
{
  。。。//执行的操作
  }

当判断if(m_pRecordset->adoEOF)时,要耗时3秒左右,因为我要查询很多次,所以这个查过程会很慢。不知道怎么会那么慢呢??求教!!!

作者: weihaimazheng   发布时间: 2011-12-03

直接放到记录集中,然后再处理

作者: oyljerry   发布时间: 2011-12-03

热门下载

更多