GetRecordCount()返回记录条数为啥总为-1
来源:互联网 发布:华小夏汉服淘宝 编辑:程序博客网 时间:2024/05/21 11:13
执行类似以下语句后,得到结果总是-1.
pRecordSet = pConnection->Execute(bstrQuery,NULL, adCmdText);pRecordSet->GetRecordCount();
原因在于默认游标是向前搜索的,所以在连接上数据库后设置游标即可。
try { pConnection->Open (strConnect,"","", adModeUnknown); //连接数据库 <strong>pConnection->CursorLocation = adUseClient;</strong>} catch(_com_error e) { AfxMessageBox("连接数据库时出错\n"); exit(0); }
或者直接执行查询语句。
pRecordSet = pConnection->Execute("select count(*) as total from testViewData where year>=1990 and year<=2006 and latitude between 3200 and 4200 and longitude between 10800 and 12400", NULL, adCmdText);int tempCount = int(pRecordSet->GetCollect("total"));
第二种方法较好。
0 0
- GetRecordCount()返回记录条数为啥总为-1
- 关于ADO记录集GetRecordCount()返回记录条数-1的问题
- 解决记录条数出错的问题(GetRecordCount)
- PHP查询语句,返回总记录数
- Acess中GetRecordCount()返回-1问题
- mysql超一亿条记录中快速查询总记录条数
- hibernate查询记录条数返回类型
- sql语句,限制返回记录条数
- Mybatis 查询int类型数据,返回记录条数为0时报错问题解决
- Hibernate DetachedCriteria方式分页查询返回总记录数
- MyBatis多条件分页查询,返回总记录数
- <!--+查询总记录数+-->
- 查总记录数
- datagrid获取页面总记录数的方法,datagrid获取页面总记录数为0的解决方法
- 得到SQL语句返回的记录条数(总数)
- 使用 m_pRecordset->GetRecordCount();获取记录数不准确的问题总结
- GetRecordCount()
- 统计一个数据库中所有表的总记录条数
- Python学习:tuple
- 安卓--画廊(Gallery)组件
- Avoid The Lakes POJ
- AssetBundle------ 资源打包和依赖资源打包
- freeMark全解
- GetRecordCount()返回记录条数为啥总为-1
- 对数据分布进行可视化的方法
- 获得路由器pin码
- MySQL绿色解压缩版安装与配置
- ibatis学习资料
- 解决NDK Unresolved inclusion
- 关注无深度图的视点绘制技术
- awk
- eclipse生成jar包