标题:C#修改密码代码
取消只看楼主
qq734885940
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2013-4-9
结帖率:0
已结贴  问题点数:20 回复次数:0 
C#修改密码代码
if (textBox1.Text == ""||textBox2.Text == ""||textBox3.Text == "")             {                 if (MessageBox.Show("      您输入的信息不完整!     ,是否关闭窗口", "提示",                           MessageBoxButtons.YesNo, MessageBoxIcon.Question) ==                           DialogResult.Yes)                 {                     this.Close();                                     }             }             else  if(textBox2.Text!=textBox3.Text)             {                 if (MessageBox.Show("     您的新密码输入错误!     ,是否关闭窗口", "提示",                           MessageBoxButtons.YesNo, MessageBoxIcon.Question) ==                           DialogResult.Yes)                 {                     this.Close();                                     }             }             else if (textBox1.Text != "")             {                 string constr = "integrated security=SSPI;data source=.;persist security info=False;initial catalog=anne";                 SqlConnection sqlConnection1 = new SqlConnection(constr);                 string sq1 = "select 密码 from 密码表 where 用户名='admin'";                 SqlDataAdapter sqlDataAdapter1 = new SqlDataAdapter(sq1, sqlConnection1);                 DataSet dt1 = new DataSet();                 sqlDataAdapter1.Fill(dt1, "密码表");                 string sq2= textBox1.Text;                 string sq3 = (string)dt1.Tables["密码表"].Rows[0]["密码"];                 if (sq2.Equals(sq3.Trim()) && textBox2.Text == textBox3.Text)                 {                     string constr1 = "integrated security=SSPI;data source=.;persist security info=False;initial catalog=anne";                     string sq4 = "update 密码表 set 密码='" + textBox2.Text + "' where 密码='" + textBox1.Text + "'";                     SqlConnection sqlConnection = new SqlConnection(constr1);                     sqlConnection.Open();                     SqlCommand cd = new SqlCommand(sq4, sqlConnection);                     SqlDataReader sr = cd.ExecuteReader();                     MessageBox.Show("    密码已修改成功    ", "提  醒");
搜索更多相关主题的帖子: 修改密码 信息 
2013-04-12 09:02



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-403952-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.094854 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved