我开发了一个带有C#的网页ASP.net,用于使用AJAX PasswordStrenght
Control更新oracle数据库中的密码。当Password符合描述要求时,通过单击按钮,它应该更新数据库中的密码。但是,当我点击按钮时,它不是数据库中的更新密码。
PasswordStrenght代码: -
<ajaxToolkit:PasswordStrength ID="PasswordStrength1" runat="server" DisplayPosition="RightSide" StrengthIndicatorType="BarIndicator"
TargetControlID="TextBox1" PrefixText="Stength:" Enabled="true"
RequiresUpperAndLowerCaseCharacters="true" MinimumLowerCaseCharacters="1"
MinimumUpperCaseCharacters="1" MinimumSymbolCharacters="1"
MinimumNumericCharacters="1" PreferredPasswordLength="10"
TextStrengthDescriptions="VeryPoor; Weak; Average; Strong; Excellent"
StrengthStyles="VeryPoor; Weak; Average; Excellent; Strong;"
CalculationWeightings="25;25;15;35" BarBorderCssClass="border"
HelpStatusLabelID="Label1" />
请参考以下代码: -
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Label2.Text = Session["PERNR"].ToString();
Label3.Text = Session["ZZFNAME"].ToString();
}
}
protected void Button1_Click(object sender, EventArgs e)
{
if (Label1.Text == "" && TextBox1.Text != "")
{
OracleConnection con = new OracleConnection("Data Source=10.127.240.216/ipcldb;User ID=ipcltos;Password=ipcltos;Unicode=True");
con.Open();
OracleCommand cmd = new OracleCommand("UPDATE SAP_EMPMST SET PASSWORD = '" + TextBox1.Text + "' WHERE PERNR = '" + Label2.Text + "'", con);
cmd.ExecuteNonQuery();
string display = "New Password has been updated...!!!";
ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + display + "');", true);
con.Close();
}
else
{
string display = "New Password is not matching with security requirments...!!!";
ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + display + "');", true);
}
}