cusgai.aspx.cs

来自「大中型酒店管理系统」· CS 代码 · 共 92 行

CS
92
字号
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 + =
减小字号Ctrl + -
显示快捷键?