当前位置: 代码迷 >> .NET面试 >> 帮忙看看,该怎么解决
  详细解决方案

帮忙看看,该怎么解决

热度:205   发布时间:2016-05-04 23:11:45.0
帮忙看看
无法转向啊
C# code
 protected void Button1_Click(object sender, EventArgs e)    {        try        {            cn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["CoalLogiMConnectionString"].ConnectionString);            cn.Open();            SqlCommand sc = new SqlCommand("select stuffNum,password, zone,depart,position from userInfo where stuffNum='" + TextBox1.Text + "' and password='" + TextBox2.Text + "'", cn);            da = sc.ExecuteReader();            da.Read();            Session["stuffNum"] = da.GetValue(0).ToString();            Session["password"] = da.GetValue(1).ToString();            Session["zone"] = da.GetValue(2).ToString();            Session["depart"] = da.GetValue(3).ToString();            Session["position"] = da.GetValue(4).ToString();            if (TextBox1.Text != "" && TextBox2.Text != "")            {                if (TextBox1.Text.ToString() == Session["stuffNum"].ToString() && TextBox2.Text.ToString() == Session["password"].ToString())                {                    Response.Redirect("Main.aspx");                }                else                {                    Response.Write("<script language=javascript>alert('您输入的账号或者密码有误');'</script>");                }            }            else            {                Response.Redirect("Login.aspx");            }            da.Close();        }        finally        {            cn.Close();        }    }


------解决方案--------------------
一步一步跟进去,看怎么回事?
------解决方案--------------------
友情帮顶。
  相关解决方案