Access教程 如何模糊参数进行分页查询代码建站知
导读:1建站知识本次Access教程,主要给大家介绍代码,下面重点给大家介绍如何模糊参数进行分页查询的教程,接下来一起来看看制作的代码吧! 下面重点给大家介绍如何模糊参数进行分网站推广优化seo个业网站建设公司。
本次Access教程,主要给大家介绍代码,下面重点给大家介绍如何模糊参数进行分页查询的教程,接下来一起来看看制作的代码吧!
下面重点给大家介绍如何模糊参数进行分页查询的教程,接下来一起来看看制作的代码吧!
具体代码如下:
string sql = "Select Count(ID) As rcount From TbProduct WHERE classID IN(" + ids + ") AND PRODUCTNAME LIKE '%'+@ProductName+'%'";
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 PRODUCTNA企业网站建设ME LIKE '%'+@ProductName+'%' Order by ID desc";
}
else
{
int minRecord = (pageIndex - 1) * pageSize;
sql = "Select Top " + pageSize.百度seo网站优化ToString() + " * From TbProduct Where ID Not In(Select ID From (Select Top " + minRecord.ToString() + " 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 = 0;
}
return AccessDB.ExecuteDataSet(sql, sps).Tables[0];
相关[标签网站建设多少钱:植入关键词]。声明: 本文由我的SEOUC技术文章主页发布于:2023-05-23 ,文章Access教程 如何模糊参数进行分页查询代码建站知主要讲述分页,模糊,Access教程 如何模糊参数进行分页查询网站建设源码以及服务器配置搭建相关技术文章。转载请保留链接: https://www.seouc.com/article/web_5530.html