在没有任何数据时进行无效的读取尝试.做的是.NET项目
if(denglu_ShenFen.SelectedItem.Text!="超级用户"){stringuserpassword=jiudian.MD5(denglu_mi...
if (denglu_ShenFen.SelectedItem.Text != "超级用户")
{
string userpassword = jiudian.MD5(denglu_mima.Text);
string denglu = @"select * from NeiBu where N_nameID='" + denglu_gonghao.Text +
"'and N_password='" + userpassword +
"'and N_power='" + denglu_ShenFen.SelectedItem + "'";
if (jiudian.sqldatareader(denglu).Read())
{
string username;
string name = "select N_Name from NeiBu where N_nameID='" + denglu_gonghao.Text + "'";
if (jiudian.sqldatareader(name).Read())
{
username = jiudian.sqldatareader(name)["N_Name"].ToString();
//Session["username"] = username;//酒店内部人员用工号登录系统后在主页上面显示Session["username"]姓名
Response.Write("<script> alert('登录成功!');</script>");
}
}
else
{
Response.Write("<script> alert('登录失败!');</script>");
}
}
JiuDian jiudian = new JiuDian(); 展开
{
string userpassword = jiudian.MD5(denglu_mima.Text);
string denglu = @"select * from NeiBu where N_nameID='" + denglu_gonghao.Text +
"'and N_password='" + userpassword +
"'and N_power='" + denglu_ShenFen.SelectedItem + "'";
if (jiudian.sqldatareader(denglu).Read())
{
string username;
string name = "select N_Name from NeiBu where N_nameID='" + denglu_gonghao.Text + "'";
if (jiudian.sqldatareader(name).Read())
{
username = jiudian.sqldatareader(name)["N_Name"].ToString();
//Session["username"] = username;//酒店内部人员用工号登录系统后在主页上面显示Session["username"]姓名
Response.Write("<script> alert('登录成功!');</script>");
}
}
else
{
Response.Write("<script> alert('登录失败!');</script>");
}
}
JiuDian jiudian = new JiuDian(); 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询