string strSql="Select Top "+PageSize+" * from TBLNEWS where ID not in(select top "+PageSize*CurrentPage+" ID from TBLNEWS order by id asc) order by id asc";
这是根据ID分页的 这个能够通过但项目要求通过分类名称(CatalogName)来分页,然后我就把代码改成
string strSql="Select Top "+PageSize+" * from TBLNEWS where CatalogName like '"+this.m_strName+"%' not in(select top "+PageSize*CurrentPage+" CatalogName like '"+this.m_strName+"%' from TBLNEWS order by id asc) order by id asc";
很不幸,抱错,调试说数据库里没数据之后我改成string strSql = "select * from TBLNEWS where CatalogName like '"+this.m_strName+"%'";
这个只是把分类的查出来,根本没实现分页功能this.m_strName为接收CatalogName的参数
这是根据ID分页的 这个能够通过但项目要求通过分类名称(CatalogName)来分页,然后我就把代码改成
string strSql="Select Top "+PageSize+" * from TBLNEWS where CatalogName like '"+this.m_strName+"%' not in(select top "+PageSize*CurrentPage+" CatalogName like '"+this.m_strName+"%' from TBLNEWS order by id asc) order by id asc";
很不幸,抱错,调试说数据库里没数据之后我改成string strSql = "select * from TBLNEWS where CatalogName like '"+this.m_strName+"%'";
这个只是把分类的查出来,根本没实现分页功能this.m_strName为接收CatalogName的参数
然后再根据你需要列进行group by 当然 这时候需要控制rownum