主题:登陆验证问题????
下面就不会了,我要判断帐号和密码是否正确,正确就进入会员管理中心,错误就给出错误信息,并返回上一页,要求重新登陆
String url="jdbc:mysql://localhost/"+dbName+"?user="+userName+"&password="+userPasswd;
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection connection=DriverManager.getConnection(url);
Statement statement = connection.createStatement();
String sql="SELECT * FROM admin_admin where user='"+user+"'and pass='"+pass+"'";
ResultSet rs = statement.executeQuery(sql);
if (rs.next()){
String url="jdbc:mysql://localhost/"+dbName+"?user="+userName+"&password="+userPasswd;
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection connection=DriverManager.getConnection(url);
Statement statement = connection.createStatement();
String sql="SELECT * FROM admin_admin where user='"+user+"'and pass='"+pass+"'";
ResultSet rs = statement.executeQuery(sql);
if (rs.next()){