{
if (TextBox2.Text.ToString().Trim() == "" || TextBox1.Text.ToString().Trim() == "")
{
Response.Write("<script>javascript:alert('请输入完整');history.back();</script>");
Response.End();
}
string sql;
if (RadioButton1.Checked)
{
sql = "select * from allusers where username='" + TextBox2.Text.ToString().Trim() + "' and pwd='" + TextBox1.Text.ToString().Trim() + "'";
}
else
{
sql = "select * from yuangong where bh='" + TextBox2.Text.ToString().Trim() + "' and pwd='" + TextBox1.Text.ToString().Trim() + "'";
}
DataSet result = new DataSet();
result = new Class1().hsggetdata(sql);
if (result != null)
{
if (result.Tables[0].Rows.Count > 0)
{
Session["username"] = TextBox2.Text.ToString().Trim();
if (RadioButton1.Checked)
{
Session["role"] = result.Tables[0].Rows[0]["cx"].ToString().Trim();
}
else
{
Session["role"] = "员工";
}
Response.Redirect("default.htm");
}
else
{
Response.Write("<script>javascript:alert('对不起,用户名或密码不正确!');</script>");
}
}
else
{
Response.Write("<script>javascript:alert('对不起,系统错误,请不要越权操作!');</script>"); ASP.net+Sqlsrver的HR管理系统设计与实现(11):http://www.751com.cn/jisuanji/lunwen_1752.html