⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dropdownlist.aspx

📁 asp.net技术内幕的书配源码
💻 ASPX
字号:
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Data.SqlClient" %>

<script runat=server>

void Page_Load(Object sender , EventArgs e) 
{
	if (! IsPostBack ) {
		SqlConnection conPubs;
		SqlCommand cmdSelect;
		SqlDataReader dtrAuthors;

		conPubs = new SqlConnection( @"Server=localhost;Integrated Security=SSPI; Database=Pubs" );
		conPubs.Open();
		cmdSelect = new SqlCommand( "Select au_lname From Authors", conPubs );
		dtrAuthors = cmdSelect.ExecuteReader();

		dropAuthors.DataSource = dtrAuthors;
		dropAuthors.DataTextField = "au_lname";
		dropAuthors.DataBind();

		dtrAuthors.Close();
		conPubs.Close();
	}
}

</Script>

<html>
<head><title>DropDownList.aspx</title></head>
<body>
<form Runat="Server">

<asp:DropDownList
  ID="dropAuthors"
  Runat="Server" />

<asp:Button
  Text="Pick Author!"
  Runat="Server" />

</form>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -