protected void BtnLogin_Click(object sender, EventArgs e) { SuperConn scnn = new SuperConn("User.accdb"); scnn.Open(); string _sql = "SELECT * FROM T_user WHERE (U_name = '" + TbName.Text + "' AND U_password = '******' AND U_valid = True)"; //Response.Write(_sql); OleDbDataReader dr = scnn.GetDataReader(_sql); if (dr.Read()) { //Response.Write(_sql); Session["user"] = TbName.Text; Boolean i = Boolean.Parse(dr["U_admin"].ToString()); if (i) { Session["admin"] = i; } LabelState.Text = "登陆成功!"; } else { LabelState.Text = "登录失败!"; } scnn.Close(); LabelState.Visible = true; TbName.Text = TbPassword.Text = ""; }
protected void ReOrder(object s, CommandEventArgs e) { SuperConn scnn = new SuperConn("OrderData.accdb"); scnn.Open(); string _sql = "SELECT * FROM T_order WHERE O_id=" + e.CommandArgument.ToString(); OleDbDataReader dr = scnn.GetDataReader(_sql); dr.Read(); try { tbname.Text = dr["O_name"].ToString(); tbbrand.Text = dr["O_brand"].ToString(); tbitem.Text = dr["O_item"].ToString(); tbnumber.Text = dr["O_number"].ToString(); } catch { } scnn.Close(); MultiView1.ActiveViewIndex = 0; }