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

📄 cst_customer_add.aspx.cs

📁 小型的一个简单的系统开发的实现了简---添加--删除--修改---(vs2005和SQl2005)用到了一些JS脚本
💻 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;

public partial class Admin_CST_customer_add : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

        if (Convert.ToString(Session["name"]) == "")
        {
            Response.Write("<script language=javascript>alert('请登陆!');location='../login.aspx'</script>");
        }
        else
        { 
         this.TxtID.Focus();
         if (!this.IsPostBack)
         {
             string getCustID = Request["getID"].ToString();
            
            if(getCustID=="null")
            {

            }
             else
            {
                
                Ccustomer oCcust = new Ccustomer();
                DataRowView view_Cust = oCcust.SelectTable(getCustID).DefaultView[0];
                this.TxtID.Text = view_Cust["cust_id"].ToString();
                this.TxtName.Text = view_Cust["name"].ToString();
                this.TxtPwd.Text = view_Cust["password"].ToString();
                this.TxtEmali.Text = view_Cust["email"].ToString();
                this.btOK.Text = "修改";
                this.LabF.Text = "修改类别名称";
                this.TxtID.Enabled = false;
                this.TxtName.Focus();
            }
        }
      }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {

        Ccustomer oCcust = new Ccustomer();
        if (this.btOK.Text == "修改")
        {
            bool T = oCcust.update(this.TxtID.Text, this.TxtName.Text, this.TxtPwd.Text, this.TxtEmali.Text);
            if (T)
            {
                Response.Write("<script>alert('修改成功!');history.back()</script>");
            }
            else
            {
                Response.Write("<script>alert('修改失败!');history.back()</script>");

            }
        }
        else
        {
            if (oCcust.Add(this.TxtID.Text, this.TxtName.Text,this.TxtPwd.Text,this.TxtEmali.Text))
            {
                Response.Write("<script>alert('添加成功!');history.back()</script>");
            }
            else
            {
                Response.Write("<script>alert('添加失败!');history.back()</script>");

            }
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (this.btOK.Text == "修改")
        {
            this.TxtName.Text = "";
            this.TxtPwd.Text = "";
            this.TxtEmali.Text = "";
        }
        else 
        {
            this.TxtID.Text = "";
            this.TxtName.Text = "";
            this.TxtPwd.Text = "";
            this.TxtEmali.Text = "";

        }
       
    }
}

⌨️ 快捷键说明

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