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

📄 editroom.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 editroom : System.Web.UI.Page
{
    SqlConnection cn;
    DataSet ds = new DataSet();
    DataTable mytable = new DataTable();

    protected void Page_Load(object sender, EventArgs e)
    {
        int id = int.Parse(Request.QueryString["id"]);
        if (!Page.IsPostBack)
        {
            if (Convert.ToString(Session["role"]) == "普通用户")
            {
                Response.Write("<script language='javascript'>alert('非常抱歉!您不是"管理员",不能进入该页面!^_^');window.location.href='Default.aspx'</script>");
            }
            cn = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["cn"]);
            cn.Open();
            SqlDataAdapter da = new SqlDataAdapter("select* from room where id='"+id+"'", cn);
            da.Fill(ds, "room");
            mytable = ds.Tables["room"];
            this.txtaddr .Text = Convert.ToString(mytable.Rows[0]["roompos"]);
            this.txtcount .Text = Convert.ToString(mytable.Rows[0]["pcount"]);
            this.txtnote.Text = Convert.ToString(mytable.Rows[0]["note"]);
            this.txtname .Text = Convert.ToString(mytable.Rows[0]["roomname"]);


        }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
       int id = int.Parse(Request.QueryString["id"]);
        if (Page.IsValid)
        {
            try
            {
                int count = Convert.ToInt32(this.txtcount.Text.Trim());
                cn = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["cn"]);
                cn.Open();
                SqlCommand cmd = new SqlCommand("update room set roomname='" + this.txtname.Text.Trim() + "',roompos='" + this.txtaddr.Text.Trim() + "',pcount='" + count + "',note='" + this.txtnote.Text.Trim() + "' where id='"+id+"'", cn);
                cmd.ExecuteNonQuery();
                this.HyperLink1.Visible = true;
                this.Labmessage.Text = "编辑会议室成功";
            }
            catch
            {
                this.Labmessage.Text = "服务器忙,请一会在试!";
            }
            finally
            {
                cn.Close();
            }
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        this.txtname.Text = "";
        this.txtaddr.Text = "";
        this.txtnote.Text = "";
        this.txtname.Focus();
        this.txtcount.Text = "";
        this.Labmessage.Text = "";

    }
}

⌨️ 快捷键说明

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