private void wlkclistgrid_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
this.wlkclistgrid.CurrentPageIndex=e.NewPageIndex;
this.bind();//必须有
}
//==========定义绑定方法bind()
public void bind()
{
try
{
ds.Clear();
string connstr = ConfigurationSettings.AppSettings ["wlkcdb"].ToString ();
myConnection = new OleDbConnection(connstr);
string sqlstr="select * from WLKC where KCLB='"+this.Session["kclb"].ToString()+"'";
dp=new OleDbDataAdapter(sqlstr,myConnection) ;
this.myConnection.Open();
dp.Fill(ds,"wlkc");//传递给“网络课程”表
this.wlkclistgrid.DataSource = ds.Tables["wlkc"].DefaultView;
this.wlkclistgrid.DataBind();
this.myConnection.Close();
}
catch
{
Response.Redirect ("database-error.htm");
}
}
{
this.wlkclistgrid.CurrentPageIndex=e.NewPageIndex;
this.bind();//必须有
}
//==========定义绑定方法bind()
public void bind()
{
try
{
ds.Clear();
string connstr = ConfigurationSettings.AppSettings ["wlkcdb"].ToString ();
myConnection = new OleDbConnection(connstr);
string sqlstr="select * from WLKC where KCLB='"+this.Session["kclb"].ToString()+"'";
dp=new OleDbDataAdapter(sqlstr,myConnection) ;
this.myConnection.Open();
dp.Fill(ds,"wlkc");//传递给“网络课程”表
this.wlkclistgrid.DataSource = ds.Tables["wlkc"].DefaultView;
this.wlkclistgrid.DataBind();
this.myConnection.Close();
}
catch
{
Response.Redirect ("database-error.htm");
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货