评论会员:imgsrc= 时间:2012/02/07
NandaKumer:检查这些博客
{A}
{A2}
- NDK的
评论会员:乌玛・尚卡尔帕特尔 时间:2012/02/07
编码
protected void Button2_Click(object sender, EventArgs e)
{
try
{
string str = "update AdminLogin set password=@password where userid=@userid";
SqlCommand cmd = new SqlCommand(str, Db.GetConnection());
cmd.Parameters.AddWithValue("@userid", TextBox2.Text);
MD5CryptoServiceProvider md5Hasher = new MD5CryptoServiceProvider();
byte[] hashedBytes = null;
UTF8Encoding encoder = new UTF8Encoding();
hashedBytes = md5Hasher.ComputeHash(encoder.GetBytes(TextBox3.Text));
SqlParameter sqp = new SqlParameter("@password", System.Data.SqlDbType.Binary, 16);
sqp.Value = hashedBytes;
cmd.Parameters.Add(sqp);
cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
Response.Write(ex.ToString());
}
}
解码
{C}