using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.OleDb;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
public partial class WebAdmin_Class : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Start();
}
/// <summary>
/// 页数据初始化
/// </summary>
private void Start()
{
String Sql = "select id,classname from class";
DataTable DT = new DataTable();
OleDbConnection Conn=new OleDbConnection();
Conn.ConnectionString = ConfigurationManager.ConnectionStrings["ConnString"].ConnectionString;
using (OleDbDataAdapter Ap = new OleDbDataAdapter(Sql,Conn))
{
Ap.Fill(DT);
DropDownList1.DataSource = DT;
DropDownList1.DataTextField = "ClassName";
DropDownList1.DataValueField = "ID";
DropDownList1.DataBind();
DropDownList1.Items.Add(new ListItem(" - 无 - ", "0"));
DropDownList1.SelectedValue = "0";
}
Sql = "select id,classname from class where strid=0";
using (OleDbDataAdapter Ap = new OleDbDataAdapter(Sql, Conn))
{
DT.Clear();
Ap.Fill(DT);
DropDownList2.DataSource = DT;
DropDownList2.DataTextField = "ClassName";
DropDownList2.DataValueField = "ID";
DropDownList2.DataBind();
DropDownList2.Items.Add(new ListItem(" - 全部 - ","0"));
DropDownList2.SelectedValue = "0";
}