?? find_cl.aspx.cs
字號:
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;
namespace txl
{
/// <summary>
/// find_cl 的摘要說明。
/// </summary>
public class find_cl : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox txtSchkey;
protected System.Web.UI.WebControls.RegularExpressionValidator RegularExpressionValidator1;
protected System.Web.UI.WebControls.DropDownList ddlSchtype;
protected System.Web.UI.WebControls.DropDownList ddlSchcity;
protected System.Web.UI.WebControls.Button btnNext1;
OleDbConnection cn;
OleDbCommand cmd;
OleDbDataReader dr;
string strConn,strSQL;
protected System.Web.UI.WebControls.Label lblSchtype;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此處放置用戶代碼以初始化頁面
if(Session.Count==0) Page.Response.Redirect("default.aspx");
else
if(Session["uid"].ToString()=="") Page.Response.Redirect("default.aspx");
if(!Page.IsPostBack)
{
ddlSchtype.Items.Add("-=請選擇您的學(xué)校類型=-");
ddlSchtype.Items.Add("大 學(xué)(大學(xué)、大專、研究所等)");
ddlSchtype.Items.Add("中 學(xué)(高中、初中)");
ddlSchtype.Items.Add("中 專(技校、中專等)");
ddlSchtype.Items.Add("小 學(xué)");
strConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("txl.aspx");
strSQL="select c_name from city where c_pid="+Page.Request["pid"].ToString();
//strSQL="select c_name from city where c_pid=1";
cn=new OleDbConnection(strConn);
cn.Open();
cmd=new OleDbCommand(strSQL,cn);
dr=cmd.ExecuteReader();
while(dr.Read())
ddlSchcity.Items.Add(dr["c_name"].ToString());
cn.Close();
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN:該調(diào)用是 ASP.NET Web 窗體設(shè)計器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 設(shè)計器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內(nèi)容。
/// </summary>
private void InitializeComponent()
{
this.btnNext1.Click += new System.EventHandler(this.btnNext1_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void btnNext1_Click(object sender, System.EventArgs e)
{
if(ddlSchtype.SelectedIndex==0)
lblSchtype.Visible=true;
else
{
string P1,P2,P3;
strConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("txl.aspx");
P1=ddlSchcity.SelectedItem.Text.ToString();
cn=new OleDbConnection(strConn);
strSQL="select c_id from city where c_name='"+P1+"'";
cn.Open();
cmd=new OleDbCommand(strSQL,cn);
dr=cmd.ExecuteReader();
while(dr.Read())
P1=dr[0].ToString();
dr.Close();
cn.Close();
P2=ddlSchtype.SelectedIndex.ToString();
P3=txtSchkey.Text.ToString();
//Page.Response.Write(P1);
Page.Response.Redirect("find_cl2.aspx?cid="+P1+"&typ="+P2+"&kywd="+P3+"&pid="+Page.Request["pid"].ToString());
}
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -