没有结果集

发布时间:2019-07-29 16:53:43

Class.forName(".microsoft.sqlserver.jdbc.SQLServerDriver");Connection conn = DriverManager.getConnection(                  "jdbc:sqlserver://localhost:1433;databaseName=bysjglxt","sa","123456");String username=request.getParameter("username"); String password=request.getParameter("mima"); String lx= new String(request.getParameter("lx").getBytes("8859_1")); //PreparedStatement stmt = conn.prepareStatement(sql); if(lx.equals("学生")) {     sql="select * from xueshengxinxi where xuehao='"+username+"' and mima='"+password+"'"; } else {     sql="select * from jiaoshixinxi where gonghao='"+username+"' and mima='"+password+"'"; }PreparedStatement stmt = conn.prepareStatement(sql); ResultSet RS_result=stmt.executeQuery(); if(RS_result.next()){    out.println("<script>alert('你输入的用户不存在或密码错误,请重新登录!');window.history.go(-1);</script>");    }else{            session.setAttribute("username",username);              session.setAttribute("lx",lx);          response.sendRedirect("index.jsp");         }

推荐回答

还没有选出推荐答案,请稍候访问或查看其他回答!

其他回答

这个肯定是没有结果的

以上问题属网友观点,不代表本站立场,仅供参考!