using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using GHSqlConn;
using Wuqi.Webdiyer;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack) {
SqlConnection conn = DB.getConnection();
conn.Open();
SqlCommand Count = new SqlCommand();
Count.Connection = conn;
Count.CommandText = "select count(*) from T_SoftDown1";
AspNetPager1.RecordCount = (int)Count.ExecuteScalar();
//Response.Write(AspNetPager1.RecordCount);
conn.Close();
BindData();
}
}
public void BindData()
{
SqlConnection conn = DB.getConnection();
string sql = "select * from T_SoftDown1 order by E_id desc";//这句在大型数据中应该用:select top查询语句
SqlDataAdapter da = new SqlDataAdapter(sql, conn);
DataSet ds = new DataSet();
da.Fill(ds, AspNetPager1.PageSize * (AspNetPager1.CurrentPageIndex - 1), AspNetPager1.PageSize, "temptbl");
DataTable dt = ds.Tables["temptbl"];
SoftDown.DataSource=dt;
SoftDown.DataBind();
}
protected void AspNetPager1_PageChanged(object src, EventArgs e)
{
//AspNetPager1.CurrentPageIndex = e.NewPageIndex;
BindData();
}
}
您可能感兴趣的文章: