国内最全IT社区平台 联系我们 | 收藏本站
华晨云阿里云优惠2
您当前位置:首页 > 数据库 > access > Access 模糊参数 分页查询

Access 模糊参数 分页查询

来源:程序员人生   发布时间:2014-01-23 18:23:35 阅读次数:3220次

  

  复制代码 代码如下:

  string sql = Select Count(ID) As rcount From TbProduct WHERE classID IN( + ids + ) AND PRODUCTNAME LIKE %+@ProductName+%;
OleDbParameter[] sps = new OleDbParameter[];
sps[] = AccessDBCreateParameter(@ProductName OleDbTypeVarChar productName ParameterDirectionInput);
int resultCount = (int)AccessDBExecuteScalar(sql sps);
recordCount = resultCount;
if (resultCount >= )
{
if ((resultCount % pageSize) == )
{
pageCount = resultCount / pageSize;
}
else
{
pageCount = (resultCount / pageSize) + ;
}
if (pageIndex == )
{
sql = Select Top + pageSizeToString() + * From TbProduct WHERE classID IN( + ids + ) AND PRODUCTNAME LIKE %+@ProductName+% Order by ID desc;
}
else
{
int minRecord = (pageIndex ) * pageSize;
sql = Select Top + pageSizeToString() + * From TbProduct Where ID Not In(Select ID From (Select Top + minRecordToString() + ID From tbProduct Where classID IN( + ids + ) AND PRODUCTNAME LIKE %+@ProductName+% Order by ID desc )TemA) And classID IN( + ids + ) AND PRODUCTNAME LIKE %+@ProductName+% Order by ID desc;
}
}
else
{
pageCount = ;
}
return AccessDBExecuteDataSet(sql sps)Tables[];

生活不易,码农辛苦
如果您觉得本网站对您的学习有所帮助,可以手机扫描二维码进行捐赠
程序员人生
------分隔线----------------------------
分享到:
------分隔线----------------------------
关闭
程序员人生