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

📄 cusgai.aspx.cs

📁 大中型酒店管理系统
💻 CS
字号:
using System;
using System.Data;
using System.Data.SqlClient;
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;

public partial class cusgai : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection Conn = db.createconn();

        Conn.Open();

        SqlCommand Cmd = new SqlCommand("select * from user1 where u_id ="
    + Request.QueryString["id"], Conn);

        if (!IsPostBack)
        {
            SqlDataReader Dr = Cmd.ExecuteReader();

            if (Dr.Read())
            {

                txtCm.Text=Dr["u_name"].ToString();
                txtQu.Text=Dr["u_qu"].ToString();
                txtCjie.Text=Dr["u_introduce"].ToString();
                txtPjie.Text=Dr["u_ping"].ToString();
                txtzong.Text = Dr["u_zong"].ToString();
                txtci.Text = Dr["u_guang"].ToString();
                txtRen.Text=Dr["u_ren"].ToString();
                txtCtel.Text=Dr["u_tel"].ToString();
                txtdi.Text=Dr["u_address"].ToString();
                txtCphone.Text=Dr["u_phone"].ToString();
                txtCmail.Text=Dr["u_email"].ToString();
               
            }
        }
    }
    protected void btntijiao_Click(object sender, EventArgs e)
    {
        string mc = txtCm.Text;
        string qu = txtQu.Text;
        string cj = txtCjie.Text;
        string pj = txtPjie.Text;
        string zong = txtzong.Text;
        string guang = txtci.Text;
        string pe = txtRen.Text;
        string tl = txtCtel.Text;
        string fx = txtdi.Text;
        string pn = txtCphone.Text;
        string em = txtCmail.Text;
   
         string fullFileName = this.File2.PostedFile.FileName;
            string fileName = fullFileName.Substring(fullFileName.LastIndexOf("\\") + 1);
       
        SqlConnection Conn = db.createconn();

        Conn.Open();
        if (fileName != "")
        { 
            this.File2.PostedFile.SaveAs(Server.MapPath("logo") + "\\" + fileName);
            SqlCommand Cmd = new SqlCommand("update user1 set u_name='" + mc + "',u_qu='" + qu + "',u_logo='" + fileName + "',u_introduce='" + cj + "',u_ping='" + pj + "',u_zong='" + zong + "',u_guang='" + guang + "',u_ren='" + pe + "',u_phone='" + pn + "',u_tel='" + tl + "',u_email='" + em + "' where u_id="
           + Request.QueryString["id"], Conn);

            Cmd.ExecuteNonQuery();

            Response.Redirect("./cusmodify.aspx");

            Conn.Close();
        }
        else
        {

            SqlCommand Cmd = new SqlCommand("update user1 set u_name='" + mc + "',u_qu='" + qu + "',u_logo='" + fileName + "',u_introduce='" + cj + "',u_ping='" + pj + "',u_zong='" + zong + "',u_guang='" + guang + "',u_ren='" + pe + "',u_phone='" + pn + "',u_tel='" + tl + "',u_email='" + em + "' where u_id="
            + Request.QueryString["id"], Conn);

        Cmd.ExecuteNonQuery();

        Response.Redirect("./cusmodify.aspx");

        Conn.Close();
            }
    }
}

⌨️ 快捷键说明

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