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秒左右,因为我要查询很多次,所以这个查过程会很慢。不知道怎么会那么慢呢??求教!!!
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
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28