//客户案例
private void Bind()
{
string sel = "wym_sel_ScaseQT";
string sel2 = "wym_sel_ScaseQTAll";
//一个是传ID的,一个是页面直接加载的
if (Request.QueryString["proid"] != null)
{
cmd = new SqlCommand(sel, conn);
conn.Open();
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@type",SqlDbType.Int).Value=Convert.ToInt32(Request.QueryString["proid"].ToString());
da = new SqlDataAdapter(cmd);
ds = new DataSet();
da.Fill(ds);
conn.Close();
}
else
{
cmd = new SqlCommand(sel2,conn);
conn.Open();
cmd.CommandType = CommandType.StoredProcedure;
da = new SqlDataAdapter(cmd);
ds = new DataSet();
da.Fill(ds);
conn.Close();
}
Pager.RecordCount = ds.Tables[0].Rows.Count;
PagedDataSource pds = new PagedDataSource();
pds.DataSource = ds.Tables[0].DefaultView;
pds.AllowPaging = true;
pds.PageSize = Pager.PageSize;
pds.CurrentPageIndex = Pager.CurrentPageIndex - 1;
dtlScase.DataSource = pds;
dtlScase.DataBind();
}
protected void Pager_PageChanged(object sender, EventArgs e)
{
Bind();
}