<%@ Page language="c#" src="AuthorBrowser.aspx.cs" AutoEventWireup="false" Inherits="AuthorBrowser" %>
<%--
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;public class AuthorBrowser : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Label lblResults;
protected System.Web.UI.WebControls.DropDownList lstAuthor;
private string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0; data source=" + System.Web.HttpContext.Current.Server.MapPath("EmployeeDatabase.mdb");private void Page_Load(object sender, System.EventArgs e)
{
if (!this.IsPostBack)
{
FillAuthorList();
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
this.lstAuthor.SelectedIndexChanged += new System.EventHandler(this.lstAuthor_SelectedIndexChanged);
this.Load += new System.EventHandler(this.Page_Load);}
#endregionprivate void FillAuthorList()
{
lstAuthor.Items.Clear();// Define the Select statement.
// Three pieces of information are needed: the unique id,
// and the first and last name.
string selectSQL;
selectSQL = "SELECT FirstName, LastName, ID FROM Employee";// Define the ADO.NET objects.
OleDbConnection con = new OleDbConnection(connectionString);
OleDbCommand cmd = new OleDbCommand(selectSQL, con);
OleDbDataReader reader;// Try to open database and read information.
try
{
con.Open();
reader = cmd.ExecuteReader();// For each item, add the author name to the displayed
// list box text, and store the unique ID in the Value property.
while (reader.Read())
{
ListItem newItem = new ListItem();
newItem.Text = reader["LastName"] + ", " + reader["FirstName"];
newItem.Value = reader["ID"].ToString();
lstAuthor.Items.Add(newItem);
}
reader.Close();
}
catch (Exception err)
{
lblResults.Text = "Error reading list of names. ";
lblResults.Text += err.Message;
}
finally
{
con.Close();
}
}private void lstAuthor_SelectedIndexChanged(object sender, System.EventArgs e)
{
// Create a Select statement that searches for a record
// matching the specific author id from the Value property.
string selectSQL;
selectSQL = "SELECT * FROM Employee ";
selectSQL += "WHERE ID=" + lstAuthor.SelectedItem.Value + "";// Define the ADO.NET objects.
OleDbConnection con = new OleDbConnection(connectionString);
OleDbCommand cmd = new OleDbCommand(selectSQL, con);
OleDbDataReader reader;// Try to open database and read information.
try
{
con.Open();
reader = cmd.ExecuteReader();
reader.Read();
lblResults.Text = "" + reader["LastName"];
lblResults.Text += ", " + reader["FirstName"] + "
";
lblResults.Text += "ID: " + reader["ID"] + "
";
reader.Close();
}
catch (Exception err)
{
lblResults.Text = "Error getting author. ";
lblResults.Text += err.Message;
}
finally
{
con.Close();
}}
}--%>
电神魔傀2街机免费版 官方版v1.2.1
下载三国战纪2手游腾讯渠道服 安卓版v2.41.0.0
下载三国战纪2手游抖音渠道服 安卓版v2.41.0.0
下载三国战纪2折扣服 安卓版v2.41.0.0
下载叫我大掌柜小米版 安卓版v7.4.4
叫我大掌柜小米版是这款模拟经营类手游的渠道服版本,在此版本中
cooking fever正版 安卓最新版v23.0.2
cooking fever正版是一款非常好玩的模拟经营类手游
咖啡厅的生活故事 最新版v1.7
咖啡厅的生活故事是一款模拟经营游戏,玩家们在游戏中可以经营一
迅猛龙模拟器金币不减反增版 v1.1.8
迅猛龙模拟器无限金币版是一款动物模拟类游戏,玩家们将在游戏中
泽塔奥特曼升华器免广告版 v1.4
泽塔奥特曼升华器去广告版是游戏的破解版本,在该版本中为玩家去