ConnectionString 属性尚未初始化。怎么解决??帮忙啊!!string strconn = ConfigurationSettings.AppSettings["dns"]; SqlConnection cn = new SqlConnect
ConnectionString 属性尚未初始化。怎么解决??帮忙啊!!string strconn = ConfigurationSettings.AppSettings["dns"]; SqlConnection cn = new SqlConnection(strconn); cn.Open(); string mysql = "select *from users where uid='" + Textbox1.Text + "'and upassword='" + Textbox2.Text + "'"; SqlCommand cm = new SqlCommand(mysql, cn); SqlDataReader dr = cm.ExecuteReader(); if (dr.Read()) { Label1.Text = ""; Session["uid"] = dr["uid"].ToString(); Session["upower"] = dr["upower"].ToString(); //Session["upassword"] = dr["upassword"].ToString(); Label1.Text = "Welcome!";// Session["uid"].ToString; if (Session["upower"].ToString() == "1") { Response.Redirect(" px"); } else if (Session["upower"].ToString() == "2") { Response.Redirect(" px"); } } else { Label1.Text = "对不起,您的用户名/密码不正确,请重新输入"; } cn.Close(); }
展开
全部