请问DataGrid查询后如何再分页?
请帮忙看下代码,为什么查询之后分页的功能就不对了
private void Page_Load(object sender, System.EventArgs e)
{
SqlConnection conn=new SqlConnection("server=QIQI;database=pubs;uid=sa;pwd=1");
SqlDataAdapter Adapter=new SqlDataAdapter("select * from authors",conn);
DataSet ds=new DataSet();
Adapter.Fill(ds);
DataGrid1.DataSource=ds;
DataGrid1.DataBind();
}
private void Button1_Click(object sender, System.EventArgs e)
{
SqlConnection conn=new SqlConnection("server=QIQI;database=pubs;uid=sa;pwd=1");
SqlDataAdapter Adapter=new SqlDataAdapter("select * from Authors where state='"+this.TextBox1.Text+"'",conn);
DataSet ds=new DataSet();
Adapter.Fill(ds);
DataGrid1.DataSource=ds;
DataGrid1.DataBind(); }
private void DataGrid1_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{this.DataGrid1.CurrentPageIndex=e.NewPageIndex;
this.DataGrid1.DataBind();
}
}
}