zoukankan      html  css  js  c++  java
  • 修改前显示员工信息

    namespace Jxc
    {
        public partial class FormEmpUpdate : Form
        {
            public FormEmpUpdate()
            {
                InitializeComponent();
            }
    
            public Employee SomeEmp { get; set; }
            
            private void FormEmpUpdate_Load(object sender, EventArgs e)
            {
                //修改前原信息
                this.textEmpId.Text = SomeEmp.EmpId.ToString();
                this.textEmpName.Text = SomeEmp.EmpName;
                this.combEmpSex.Text = SomeEmp.EmpSex;
                this.textEmpBirth.Text = SomeEmp.EmpBirth.ToString();
                this.combProvince.Text = SomeEmp.EmpProvince;
                this.textEmpCall.Text = SomeEmp.EmpCall;
                this.textEmpAddress.Text = SomeEmp.EmpAddress;
                this.txtphoto.Text = SomeEmp.EmpPhoto;
                this.combEmpDepId.Text = SomeEmp.DepId.ToString();
                this.combEmpStoId.Text = SomeEmp.StoId.ToString();
            }
            private void btnUpdateDetail_Click(object sender, EventArgs e)
            {
                int empId = Int32.Parse(this.textEmpId.Text);
                string empName = this.textEmpName.Text;
                string empSex = this.combEmpSex.Text;
                DateTime empBirth = DateTime.Parse(this.textEmpBirth.Text);
                string empCall = this.textEmpCall.Text;
                string empProvince = this.combProvince.Text;
                string empAddress = this.textEmpAddress.Text;
                string empPhoto = this.txtphoto.Text;
                int depId = Int32.Parse(this.combEmpDepId.Text);
                int stoId = Int32.Parse(this.combEmpStoId.Text);
    
                string strSql = "update employee set empName = '" + empName + "', empSex = '" + empSex + "', empBirth = '" + empBirth + "', empCall = '" + empCall + "', empProvince = '" + empProvince + "', empAddress = '" + empAddress + "', empPhoto = '" + empPhoto + "', depId = '" + depId + "', stoId = '" + stoId + "' where empId = '" + empId + "'";
    
                string conString = "server=.;database=GXT;uid=sa;pwd=tian123";
                SqlConnection con = new SqlConnection(conString);
                con.Open();
    
                SqlCommand cmd = new SqlCommand(strSql, con);
                int jieguo = cmd.ExecuteNonQuery();
                con.Close();
                DialogResult xiugai = DialogResult.Yes;
                if (jieguo > 0)
                {
                    xiugai = MessageBox.Show("修改成功确认不再修改请按yes重新修改请按no", "修改", MessageBoxButtons.YesNo);
                }
                if (xiugai == DialogResult.No)
                {
                    this.textEmpName.Text = "";
                    this.combEmpSex.Text = "";
                    this.textEmpBirth.Text = "";
                    this.combProvince.Text = "";
                    this.textEmpCall.Text = "";
                    this.textEmpAddress.Text = "";
                    this.txtphoto.Text = "";
                    this.combEmpDepId.Text = "";
                    this.combEmpStoId.Text = "";
                }
                else
                {
                    this.Close();
                }
            }
        }
    }
  • 相关阅读:
    SpringMVC文件上传
    c函数调用过程原理及函数栈帧分析
    《C++游戏开发》笔记十一 平滑动画:不再颤抖的小雪花
    Java学习笔记——IO操作之以图片地址下载图片
    uva 400 Unix ls 文件输出排版 排序题
    【VC++积累】之八、PreTranslageMessage;TranslageMessage;GetMessage和PeekMessage的区别
    uva 331 Mapping the Swaps 求交换排序的map 纯DFS
    uva 10344 23 out of 5 凑运算结果 全排列+dfs
    Java学习笔记——File类文件管理及IO读写、复制操作
    uva 301 Transportation 铁路公司的阳谋 纯dfs暴力
  • 原文地址:https://www.cnblogs.com/Tianxf815/p/8877626.html
Copyright © 2011-2022 走看看