==========================分页类
namespace ijsp
{
using MySql.Data.MySqlClient;
using System;
public class MysqlDBpage
{
public static int allpage = 1;
public static int allrow = 1;
public static int i = 0;
public static int pagerow = 1;
private static int startrow = 0;
public static int thispage = 1;
/// <summary>
/// 与MysqlConbean配合实现分页
/// </summary>
/// <param name="s1"> 查总记录条数,即count(*) </param>
/// <param name="s2"> 用来查询欲显示的数据 </param>
/// <param name="s3"> 获得用户输入的页码 </param>
/// <param name="s4"> 每页显示记录数 </param>
public static MySqlDataReader mysqlpage(string s1, string s2, string s3, string s4)
{
MySqlDataReader reader = MysqlConbean.ReturnDateReader(s1);
if (reader.Read())
{
allrow = Convert.ToInt32(reader[0]);
}
allpage = ((allrow + pagerow) - 1) / pagerow;
reader.Close();
//reader.Dispose();
MysqlConbean.Close();
try
{
thispage = Convert.ToInt32(s3);
}
catch (Exception)
{
thispage = 1;
}
if (thispage > allpage)
{
thispage = allpage;
}
if (thispage < 1)
{
thispage = 1;
}
try
{
pagerow = Convert.ToInt16(s4);
}
catch (Exception)
{
pagerow = 10;
}
startrow = (thispage - 1) * pagerow;
if (thispage > = 1)
{
i = (thispage * pagerow) - pagerow;
}
s2 = string.Concat(new object[] { s2, " limit ", startrow, ",", s4 });
return MysqlConbean.ReturnDateReader(s2);
}
public static void Closemysqlpage()
{
MysqlConbean.Close();
}
public static void Close()
{
MysqlConbean.Close();
}
}
}