当前位置:首页
开发技术指南» 文章正文
    引言:
 

 

    摘要: 如题。 ......
    摘要: 如题! ......


VS.net自动生成的函数调用顺序问题

private   void   Page_Load(object   sender,   System.EventArgs   e)  
  {  
  string   board;  
  if(Request["board"]   ==   null)  
  board   =   "5";  
  else  
  board   =   Request["board"];  
  this.sqlSelectCommand1.CommandText   =   "SELECT   Title,   FileName,   PostTime,   Status,   Click,   Reply,   LastReply,   ID   FROM   BBS   WHERE   Board   =   "   +   board   +   "   order   by   LastReply   desc";  
  this.sqlDataAdapter1.Fill(this.bbsDataSet1,"BBS");  
  this.DataGrid1.CurrentPageIndex   =   0;  
  this.DataGrid1.DataBind();  
  }  
   
  #region   Web   Form   Designer   generated   code  
  override   protected   void   OnInit(EventArgs   e)  
  {  
  //  
  //   CODEGEN:   This   call   is   required   by   the   ASP.NET   Web   Form   Designer.  
  //  
  InitializeComponent();  
  this.sqlConnection1.ConnectionString   =   (string)Application["ConnectionString"];  
  this.sqlSelectCommand1.CommandText   =   "SELECT   Title,   FileName,   PostTime,   Status,   Click,   Reply,   LastReply,   Score,   ID   FROM   BBS   WHERE   (Board   =   "   +   Request["board"]   +   ")";  
  base.OnInit(e);  
  }  
   
  ///   <summary>  
  ///   Required   method   for   Designer   support   -   do   not   modify  
  ///   the   contents   of   this   method   with   the   code   editor.  
  ///   </summary>  
  private   void   InitializeComponent()  
  {          
  this.sqlDataAdapter1   =   new   System.Data.SqlClient.SqlDataAdapter();  
  this.sqlSelectCommand1   =   new   System.Data.SqlClient.SqlCommand();  
  this.sqlConnection1   =   new   System.Data.SqlClient.SqlConnection();  
  this.bbsDataSet1   =   new   bbs.BBSDataSet();  
  this.dataView1   =   new   System.Data.DataView();  
  ((System.ComponentModel.ISupportInitialize)(this.bbsDataSet1)).BeginInit();  
  ((System.ComponentModel.ISupportInitialize)(this.dataView1)).BeginInit();  
  this.DataGrid1.PageIndexChanged   +=   new   System.Web.UI.WebControls.DataGridPageChangedEventHandler(this.DataGrid1_PageIndexChanged);  
  //    
  //   sqlDataAdapter1  
  //    
  this.sqlDataAdapter1.SelectCommand   =   this.sqlSelectCommand1;  
  this.sqlDataAdapter1.TableMappings.AddRange(new   System.Data.Common.DataTableMapping[]   {  
      new   System.Data.Common.DataTableMapping("Table",   "BBS",   new   System.Data.Common.DataColumnMapping[]   {  
    new   System.Data.Common.DataColumnMapping("Title",   "Title"),  
    new   System.Data.Common.DataColumnMapping("FileName",   "FileName"),  
    new   System.Data.Common.DataColumnMapping("PostTime",   "PostTime"),  
    new   System.Data.Common.DataColumnMapping("Status",   "Status"),  
    new   System.Data.Common.DataColumnMapping("Click",   "Click"),  
    new   System.Data.Common.DataColumnMapping("Reply",   "Reply"),  
    new   System.Data.Common.DataColumnMapping("LastReply",   "LastReply"),  
    new   System.Data.Common.DataColumnMapping("Score",   "Score")})});  
  //    
  //   sqlSelectCommand1  
  //    
  this.sqlSelectCommand1.CommandText   =   "SELECT   Title,   FileName,   PostTime,   Status,   Click,   Reply,   LastReply,   Score,   ID   FROM"   +  
  "   BBS   WHERE   (Board   =   N\1\)";  
  this.sqlSelectCommand1.Connection   =   this.sqlConnection1;  
  //    
  //   sqlConnection1  
  //    
  this.sqlConnection1.ConnectionString   =   "data   source=LUYANSC;initial   catalog=BBS;integrated   security=SSPI;persist   security"   +  
  "   info=False;workstation   id=LUYANSC;packet   size=4096";  
  //    
  //   bbsDataSet1  
  //    
  this.bbsDataSet1.DataSetName   =   "BBSDataSet";  
  this.bbsDataSet1.Locale   =   new   System.Globalization.CultureInfo("zh-CN");  
  this.bbsDataSet1.Namespace   =   "http://www.tempuri.org/BBSDataSet.xsd";  
  //    
  //   dataView1  
  //    
  this.dataView1.Table   =   this.bbsDataSet1.BBS;  
  this.Load   +=   new   System.EventHandler(this.Page_Load);  
  ((System.ComponentModel.ISupportInitialize)(this.bbsDataSet1)).EndInit();  
  ((System.ComponentModel.ISupportInitialize)(this.dataView1)).EndInit();  
   
  }  
  #endregion  
   
   
  请问,象上面的几个自动生成的方法中,执行顺序是怎么样的??  
  相信很多初学的人都弄不太清。  
  请高手们指教一下!!  
 

NO.1   作者: mongtze

首先执行Page_Load(),而Page_Load()里边又调用     InitializeComponent()。  
   
  DataGrid1_PageIndexChanged()是事件驱动的,只有触发了这个事件,才会调用。


 ·小弟初学,请帮我改改    »显示摘要«
    摘要: <%set cnobj = server.createobject("adodb.connection") strcon="provider=sqloledb; data source=localhost;database=forum;uid=sa;pwd=" cnobj.open strcon set rs = cnobj.execute(&......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE