using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using DevComponents.DotNetBar; using System.Data.OracleClient; namespace Cyberpipe { public partial class FrmChangePassword : Office2007Form { public static bool IS_OPEN = false; public FrmChangePassword() { InitializeComponent(); } private void btn_ok_Click(object sender, EventArgs e) { try { if (String.IsNullOrEmpty(txt_pwd_new.Text.Trim())) { MessageBox.Show("新密码不能为空!"); return; } if (!txt_pwd_new.Text.Trim().Equals(txt_pwd_cfm.Text.Trim())) { MessageBox.Show("请确认要修改的密码!"); return; } string sql = "select count(*) from casic_userinfotest where SYSNAME='EMS' and USERNAME='" + Utility.userName + "' and PASSWORD='" + Utility.MD5Encrypt2(txt_pwd_old.Text.Trim()) + "'"; int count = int.Parse(OracleUtils.ExecuteScalar(OracleUtils.ConnectionString, CommandType.Text, sql).ToString()); if (count <= 0) { MessageBox.Show("密码错误!"); return; } sql = "update casic_userinfotest set password='" + Utility.MD5Encrypt2(txt_pwd_new.Text.Trim()) + "' where sysname='EMS' and username='" + Utility.userName + "'"; OracleUtils.ExecuteNonQuery(OracleUtils.ConnectionString, CommandType.Text, sql); MessageBox.Show("修改成功!"); } catch (Exception ex) { MessageBox.Show("修改失败:" + ex.ToString()); } } private void FrmChangePassword_Load(object sender, EventArgs e) { IS_OPEN = true; } private void FrmChangePassword_FormClosing(object sender, FormClosingEventArgs e) { IS_OPEN = false; } } }