62,041
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
string strName = FormsAuthentication.HashPasswordForStoringInConfigFile(TextBox1.Text, "MD5");
string strPwd = FormsAuthentication.HashPasswordForStoringInConfigFile(TextBox2.Text, "MD5");
SqlConnection con = new SqlConnection("Server=(local);database=db_18;Uid=sa;Pwd=");
SqlDataAdapter dap = new SqlDataAdapter("select * from 系统用户加密表 where username='" + strName + "'and pwd='" + strPwd + "'", con);
DataSet ds = new DataSet();
dap.Fill(ds);
if (ds.Tables[0].Rows.Count > 0)
{
Response.Write("<script>alert('登录成功!!!')</script>");
}
else
{
Response.Write("<script>alert('用户名或密码错误,登录失败!!!')</script>");
}
}
}