SqlConnection myConnection = new SqlConnection(strConnectSQL);
SqlCommand myCommand = new SqlCommand( SQLstring, myConnection );
myConnection.Open();
Dlist.DataSource = myCommand.ExecuteReader();
Dlist.DataTextField = TextField;
Dlist.DataValueField = ValueField;
Dlist.DataBind();
myConnection.Close();
}
#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();
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.Load += new System.EventHandler(this.Page_Load);
#endregion
这样做的好处之一就是你可以在ASP.NET中指定 web 控件作为函数的输入参数。这确实改变了我的编码习惯,我现在正在开发更多的一般性的可重用代码。
这非常简单。一旦你要为一个特定的控件编码,你就不必再重新写一次了。你可以一次又一次地使用相同的代码。
2004年11月 V1.1
上一页 [1] [2] [3] [4]
Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved. 闵涛 E_mail:admin@mintao.net(欢迎提供学习资源)
鄂公网安备 42011102001154号
站长:MinTao ICP备案号:鄂ICP备11006601号-18