protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["id"] != null) { int id = Convert.ToInt16(Request.QueryString["id"]); idnum.Value = Request.QueryString["id"].ToString(); } if (!IsPostBack) { TeModel tm = new TeModel(); SqlDataReader sdr = tm.findNameAll(); if (sdr != null) { while (sdr.Read()) { this.tisaneperson.Items.Add(new ListItem(sdr["EmNumAName"].ToString())); // this.SwapPer.Items.Add(new ListItem(sdr["JobNum"].ToString())); } } DataBaseLayer db = new DataBaseLayer(); if (Session["userNamebar"] != null) { string name = Session["userNamebar"].ToString(); string sq1 = "select EmNumAName from Employee where jobnum ='" + name + "' "; SqlDataReader sr = db.get_Reader(sq1); if (sr.Read()) { tisaneperson.Value = sr["EmNumAName"].ToString(); } } else { Response.Write("<script>alert('用户名已失效');window.parent.loginview();</script>"); } } }