标题:C#修改密码代码
只看楼主
qq734885940
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2013-4-9
结帖率:0
已结贴  问题点数:20 回复次数:2 
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
elongtown
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:12
帖 子:138
专家分:1003
注 册:2013-2-18
得分:10 
问题是什么
2013-04-14 14:34
party620
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:18
帖 子:696
专家分:2521
注 册:2013-1-31
得分:10 
重新排版一下
2013-04-15 09:29



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




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

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