📄 find_cl2.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_cl2 的摘要说明。
/// </summary>
public class find_cl2 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label lblNoSchool;
protected System.Web.UI.WebControls.TextBox txtSchname;
protected System.Web.UI.WebControls.TextBox txtScherea;
protected System.Web.UI.WebControls.TextBox txtSchzip;
protected System.Web.UI.WebControls.TextBox txtSchhttp;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2;
protected System.Web.UI.WebControls.RegularExpressionValidator RegularExpressionValidator2;
protected System.Web.UI.WebControls.RegularExpressionValidator RegularExpressionValidator3;
protected System.Web.UI.WebControls.DataGrid dgdSch;
OleDbConnection cn;
OleDbCommand cmd;
OleDbDataReader dr;
OleDbDataAdapter da;
DataSet ds;
string strConn,strSQL,strUrl;
protected System.Web.UI.WebControls.Button btnNext;
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");
strConn="Provider=Microsoft.Jet.OLEDB.4.0; Data Source="+Server.MapPath("txl.mdb");
strSQL="select school.s_id,school.s_name,prove.p_name,city.c_name,school.s_erea,s_num,classtype.t_name from school,prove,classtype,city";
strSQL+=" where c_id="+Page.Request["cid"].ToString();
strSQL+=" and t_id="+Page.Request["typ"].ToString();
strSQL+=" and p_id="+Page.Request["pid"].ToString();
strSQL+=" and s_cid="+Page.Request["cid"].ToString();
strSQL+=" and s_type="+Page.Request["typ"].ToString();
strSQL+=" and s_pid="+Page.Request["pid"].ToString();
cn=new OleDbConnection(strConn);
cn.Open();
da=new OleDbDataAdapter(strSQL,cn);
ds=new DataSet();
da.Fill(ds,"school");
/*ds.Tables["school"].Columns.Add("s_url");
for(i=0;i<ds.Tables["school"].Rows.Count;i++)
ds.Tables["school"].Rows[i]["s_url"]="schid="+ds.Tables["school"].Rows[i][0].ToString()+"&uid="+Session["uid"].ToString();*/
dgdSch.DataSource=ds.Tables["school"].DefaultView;
dgdSch.DataBind();
da.Dispose();
cn.Close();
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.btnNext.Click += new System.EventHandler(this.btnNext_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void btnNext_Click(object sender, System.EventArgs e)
{
strConn="Provider=Microsoft.Jet.OLEDB.4.0; Data Source="+Server.MapPath("txl.mdb");
strSQL="INSERT INTO school(s_name,s_pid,s_cid,s_erea,s_type,s_num,s_zip,s_http,s_delflag,s_who) VALUES('";
strSQL+=txtSchname.Text+"',";
strSQL+=Page.Request["pid"].ToString()+","+Page.Request["cid"].ToString()+",'"+txtScherea.Text+"',"+Page.Request["typ"].ToString()+",0,'";
strSQL+=txtSchzip.Text+"','"+txtSchhttp.Text+"','0',"+Session["uid"].ToString()+")";
cn=new OleDbConnection(strConn);
cmd=new OleDbCommand(strSQL,cn);
cn.Open();
cmd.ExecuteNonQuery();
cmd.Dispose();
strSQL="select s_id from school where s_who="+Session["uid"].ToString()+" ORDER BY s_id DESC";
cmd=new OleDbCommand(strSQL,cn);
dr=cmd.ExecuteReader();
dr.Read();
strUrl="find_cl3.aspx?schid="+dr[0].ToString();
cn.Close();
Page.Response.Redirect(strUrl);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -