[已经解决]下面一段代码!!谢谢!!
请各位帮帮忙看一下:private void btnChange_Click(object sender, System.EventArgs e)
{
SqlConnection con=new SqlConnection(Application["conStr"].ToString());
con.Open();
string str="select * from users";
SqlCommand cmd=new SqlCommand(str,con);
SqlDataReader sdr=cmd.ExecuteReader();
string oldPassword=this.txtOldpassword.Text;
sdr.Read();
if(oldPassword==sdr["userPassword"].ToString().Trim())
{
sdr.Close();
string newPassword=this.txtOldpassword.Text;
string confirmNewpassword=this.txtConfirmNewpassword.Text;
if(newPassword==confirmNewpassword)
{
SqlConnection con1=new SqlConnection(Application["conStr"].ToString());
con1.Open();
string str1="updata users set userPassword='"+newPassword+"'";
SqlCommand cmd1=new SqlCommand(str1,con);
cmd1.ExecuteReader();
cmd1.Dispose();
con1.Close();
con1.Dispose();
}
else
{
Response.Write("<script>alert('你两次输入的密码不一致,请重新输入!');</script>");
}
}
else
{
Response.Write("<script>alert('你的原始密码不正确,请重新输入!');</script>");
}
cmd.Dispose();
con.Close();
con.Dispose();
}
[此贴子已经被作者于2007-4-23 15:23:27编辑过]