⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 homefenshu.aspx.cs

📁 学生寝室管理系统
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient ;
public partial class homefenshu : System.Web.UI.Page
{
   SqlCommand  cmd;
  SqlConnection  cn;
    string strcon, strsql;
    protected void Page_Load(object sender, EventArgs e)
    {

        if (!this.IsPostBack)
        {
            if (Convert.ToString(Session["shenfen"]) == "室员")
            {
                Response.Write("<script language='javascript'>alert('非常抱歉!您不是"寝室长",不能进入该页面!^_^');window.location.href='userindex.aspx'</script>");
            }
            else
            {
                Response.Write("<script language='javascript'>alert('您的身份是"寝室长",欢迎进入该页面!^_^');</script>");
            }
            this.txtusername.Text = Convert.ToString(Session["username"]);
            this.txtuserid.Text = Convert.ToString(Session["userid"]);

        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (this.IsValid)
        {
            cn = sqldata.createcon();
            cn.Open();
            strsql = "update home set homefen='" + this.txtcontent.Text.ToString() + "' where homesex='" + this.ddlhomesex.SelectedItem.Value.ToString() + "'and homeflood='" + this.DropDownList1 .SelectedItem .Value .ToString () + "' and homehao='" + this.txthomehao.Text.ToString().Trim() + "' and homecount='" + this.ddlhomecount.Text.ToString() + "' and homephone='"+this.txthomephone .Text .ToString ()+"'";
            cmd = new SqlCommand (strsql ,cn);
            cmd.ExecuteNonQuery();
            this.Label3.Text = "录入成功";
            cn.Close();
        }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        this.txthomehao.Text = "";
       
        this.txtcontent.Text = "";
        this.txthomephone.Text = "";
        this.txthomehao.Focus();
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -