mycodebehind
来自「这是《ASP.NET编程实作教程》一书中的源文件 如果有此书的朋友不防下载过来参」· 代码 · 共 26 行
TXT
26 行
using System;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
public class MyCodeBehind : Page {
public TextBox Name;
public DropDownList Category;
public void SubmitBtn_Click(Object sender, EventArgs e) {
if (Page.IsValid) {
SQLConnection myConnection = new SQLConnection("server=localhost;uid=sa;pwd=;database=pubs");
SQLDataSetCommand myCommand = new SQLDataSetCommand("select * from Titles where type='" + Category.SelectedItem.Value + "'", myConnection);
DataSet ds = new DataSet();
myCommand.FillDataSet(ds, "Titles");
MyList.DataSource = ds.Tables["Titles"].DefaultView;
MyList.DataBind();
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?