简要咨询咨询QQ网站导航网站搜索手机站点联系我们设为首页加入收藏 

access如何模糊参数进行分页查询代码

来源:易贤网   阅读:806 次  日期:2014-11-07 15:29:38

温馨提示:易贤网小编为您整理了“access如何模糊参数进行分页查询代码”,方便广大网友查阅!

具体代码如下:

string sql = select count(id) as rcount from tbproduct where classid in( + ids + ) and productname like;

oledbparameter[] sps = new oledbparameter[1];

sps[0] = accessdb.createparameter(@productname, oledbtype.varchar, productname, 50, parameterdirection.input);

int resultcount = (int)accessdb.executescalar(sql, sps);

recordcount = resultcount;

if (resultcount >= 0)

{

if ((resultcount % pagesize) == 0)

{

pagecount = resultcount / pagesize;

}

else

{

pagecount = (resultcount / pagesize) + 1;

}

if (pageindex == 1)

{

sql = select top + pagesize.tostring() + * from tbproduct where classid in( + ids + ) and productname like order by id desc;

}

else

{

int minrecord = (pageindex - 1) * pagesize;

sql = select top + pagesize.tostring() + * from tbproduct where id not in(select id from (select top + minrecord.tostring() + id from tbproduct where classid in( + ids + ) and productname like order by id desc )tema) and classid in( + ids + ) and productname like order by id desc;

}

}

else

{

pagecount = 0;

}

return accessdb.executedataset(sql, sps).tables[0];

更多信息请查看IT技术专栏

更多信息请查看数据库
点此处就本文及相关问题在本站进行非正式的简要咨询(便捷快速)】     【点此处查询各地各类考试咨询QQ号码及交流群
上一篇:oracle数据库的几种重新启动步骤
下一篇:access模糊查询
易贤网手机网站地址:access如何模糊参数进行分页查询代码
由于各方面情况的不断调整与变化,易贤网提供的所有考试信息和咨询回复仅供参考,敬请考生以权威部门公布的正式信息和咨询为准!