用户代码未处理ArgumentException
protectedvoidButton1_Click1(objectsender,EventArgse){OleDbConnectionconn=newOleDbConn...
protected void Button1_Click1(object sender, EventArgs e) { OleDbConnection conn = new OleDbConnection(strConnection); try { conn.Open(); string sql = "select * from Users where user_id='" + this.TextBox1.Text + "' and user_password='" + this.TextBox2.Text + "'"; OleDbCommand cmd = new OleDbCommand(sql, conn); OleDbDataReader dr = cmd.ExecuteReader(); if (this.TextBox1.Text == "" || this.TextBox2.Text == "") { Response.Write("<script>alter('帐号或者密码不能为空')</script>"); } else if (this.TextBox2.Text.Length < 6) { Response.Write("<script>alter('密码不能低于6位')</script>"); } else { if (dr.Read() == true) { //if(dr.GetInt32(2)==0) if ((int)dr["user_power"] == 0) { Response.Redirect("XtEdit.aspx"); } else if ((int)dr["user_power"] == 1) { Response.Redirect("XtEdit.aspx"); } } else { Response.Write("<script>alter('用户名或者密码错误,重新登录')</script>"); } } conn.Close(); } catch (Exception) { Response.Write("<script>alter('数据库链接失败')</script>"); } }
展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询