[C#] 修改密码 →→→→→进入此内容的聊天室

来自 , 2020-02-20, 写在 C#, 查看 161 次.
URL http://www.code666.cn/view/d756d3d2
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8.  
  9. using Common;
  10. using System.Data.SqlClient;
  11.  
  12. namespace Pos
  13. {
  14.     public partial class frmPwdChange : Form
  15.     {
  16.         public frmPwdChange()
  17.         {
  18.             InitializeComponent();
  19.         }
  20.  
  21.         private void btnOK_Click(object sender, EventArgs e)
  22.         {
  23.             if (txtNew.Text != txtConfirm.Text)
  24.             {
  25.                 MessageBox.Show("您输入的新密码与确认密码不一致!", "友好提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  26.                 return;
  27.             }
  28.  
  29.             string strsql = string.Format("select User_pwd from cen_user where User_code='{0}'", PUser.UserCode);
  30.             DataSet  ds = SQLHelper.ExecuteDataSet(strsql);
  31.             if (ds.Tables[0].Rows[0]["User_pwd"].ToString() == txtOld.Text)
  32.             {
  33.                 string strsql2 = string.Format("update cen_user set User_pwd='{0}' where User_code='{1}'", txtNew.Text, PUser.UserCode );
  34.                 SQLHelper.ExecuteNonQuery(strsql2);
  35.                 MessageBox.Show("密码修改成功!", "友好提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  36.  
  37.             }
  38.             else
  39.             {
  40.                 MessageBox.Show("您输入的旧密码不对!", "友好提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  41.                 return;
  42.             }
  43.            
  44.             this.Close();
  45.         }
  46.  
  47.         private void btnCancel_Click(object sender, EventArgs e)
  48.         {
  49.             this.Close();
  50.         }
  51.     }
  52. }

回复 "修改密码"

这儿你可以回复上面这条便签

captcha