TextBox值的比較
請問在C#中,如何通過一個Button來對兩個TextBox值的比較呢?如果兩個Textbox的值是一致的就OK,不一至就Fail
int i = 0;
DataTable dt = new DataTable(); //实例化DataTable
dt = mycon.myDataTable(sql); //执行SQL语句并返回DataTable
i = dt.Rows.Count;
if (i > 0)
{
if (yhma == querenmima.Text.Trim())
{
sql2 = String.Format("update users set UserPassword='{0}' where userdz='{1}'", yhma, ygxm);
mycon.myExecuteNonQuery(sql2);
this.Label1.Text = "<script language='javascript'>alert('密码修改成功,请用新密码登陆系统');</script>";
this.Panel1.Visible = false;
}
else
this.Label1.Text = "<script language='javascript'>alert('两次密码输入不一致,请重新输入');</script>";
}