问题描述
希望请高手指点一下:usingSystem;usingSystem.Data;usingSystem.Configuration;usingSystem.Collections;usingSystem.Web;usingSystem.Web.Security;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Web.UI.HtmlControls;usingSystem.Data.OleDb;publicpartialclassArticle_List:System.Web.UI.Page{protectedvoidPage_Load(objectsender,EventArgse){bind();if(Session["UserID"]==null){Response.Redirect("../Login/Login.aspx");}}publicvoidbind(){OleDbConnectionCon=newOleDbConnection();stringstrCon=ConfigurationManager.ConnectionStrings["Connection"].ConnectionString;Con.ConnectionString=strCon;OleDbCommandCommand=newOleDbCommand();Command.Connection=Con;Command.CommandText=string.Format("SELECTArticle.ID,Article.Title,Article.Content,Article.ArticleTime,[AboutUser].UserNameASNameFROM(ArticleINNERJOIN[AboutUser]ONArticle.UserID=[AboutUser].ID)");OleDbDataAdapterAdapter=newOleDbDataAdapter(Command);DataSetTable=newDataSet();Con.Open();Adapter.Fill(Table);Con.Close();this.GridView1.DataSource=Table;this.GridView1.DataBind();}protectedvoidGridView1_PageIndexChanging(objectsender,GridViewPageEventArgse){GridView1.PageIndex=e.NewPageIndex;GridView1.DataBind();this.bind();}protectedvoidGridView1_RowDeleting(objectsender,GridViewDeleteEventArgse){GridViewRowrow=GridView1.Rows[e.RowIndex];GridView1.DataBind();this.bind();}}