分类: asp.net----C# |
string
connection="server=IP;Uid=sa;Pwd=sa;Database=user".ToString();
string username="test".ToString();
string userpassword="test".ToString();
SqlConnection conn =new SqlCommand(Connection);
conn.Open();
SqlCommand cmd=new SqlCommand("Update table set
username='"+username+"',userpassword='"+userpassword+"'",conn)
cmd.ExcuteNonQuery();
conn.Close();
SqlConnection con=new
SqlConnection(....);
SqlCommand cmd=new SqlCommand();
cmd.Connection=con;
cmd.CommandText="select UserName,UserPwd from Users where
UserName='"+this.txtUName.Text+"'";
string uname="";
string pass="";
try
{
}
catch{}
if(uname=="")
{
}
if(pass.Trim()!=this.txtPass.Text)
{
}
if(this.txtPass.Text!=this.txtRePass.Text)
{
}
string sql="update Users set UserPwd='"+this.txtPass.Text+"' where
UserName='"+uname+"'";
try
{
}
catch(SqlException er)
{
}
MessageBox.Show("已成功修改密码!");
要修改密码太容易了,
这里给一个我写的简单密码验证的程序:
//验证新密码不能是有序的,不能是相同的字符
if(PasswordSimpleCheck(textBox3.Text.Trim())==false)
private bool
PasswordSimpleCheck(string getcode)