?? changepasswd.aspx.cs
字號:
?using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.SqlClient;
using System.Web.UI.HtmlControls;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
string myConn = System.Configuration.ConfigurationManager.ConnectionStrings["yhdaselect"].ConnectionString;
SqlConnection conn = new SqlConnection(myConn);
try
{
conn.Open();
SqlCommand cmd = new SqlCommand("logon", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@userid", TextBox1.Text);
cmd.Parameters.AddWithValue("@passwd", TextBox2.Text);
SqlParameter paramout2 = cmd.Parameters.AddWithValue("@username", "");
paramout2.Direction = ParameterDirection.Output;
SqlDataReader sda = cmd.ExecuteReader();
if (sda.Read())
{
if (TextBox3.Text == TextBox4.Text)
{
sda.Close();
SqlCommand cmd2 = new SqlCommand("changepw", conn);
cmd2.CommandType = CommandType.StoredProcedure;
cmd2.Parameters.AddWithValue("@userid", TextBox1.Text);
cmd2.Parameters.AddWithValue("@newpw", TextBox3.Text);
cmd2.ExecuteNonQuery();
Label1.Text = "密碼修改成功";
}
else
{
Label1.Text = "新密碼不一致";
}
}
else
{
Label1.Text = "用戶名或密碼錯";
}
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
finally
{
if (conn != null)
conn.Close();
}
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Redirect("login.aspx");
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -