商业源码热门下载www.html.org.cn
是用来新手入门的,高手们不要见笑呀!
string conn = "server=.;database=login;user id=sa;pwd=123";
sqlconnection cn = new sqlconnection(conn);
cn.open();
string strsql = "select user_name,user_pwd from admin where user_name='" + textbox1.text + "' or user_pwd='" + textbox2.text + "'";
sqlcommand cmd = new sqlcommand(strsql, cn);
sqldatareader rd = cmd.executereader();
if (rd.read())
{
if (rd.getvalue(0).tostring() == textbox1.text)
{
if (rd.getvalue(1).tostring() == textbox2.text)
{
response.redirect("default.aspx");
}
else
{
response.write("<script>alert('密码错误!')</script>");
}
}
else
{
response.write("<script>alert('用户名错误!')</script>");
}
}
else
{
response.write("<script>alert('用户不存在!')</script>");
}
}
新闻热点
疑难解答
图片精选