WEB开发网
开发学院WEB开发Jsp 用户登录的验证完整程序 阅读

用户登录的验证完整程序

 2008-01-05 10:43:49 来源:WEB开发网   
核心提示:public String validateUser(String inputUserid, String inputPwd) throws SQLException{ String returnString = null; String dbUserid = "userid"; // Your D

public String validateUser(String inputUserid, String inputPwd)


throws SQLException{


String returnString = null;


String dbUserid = "userid"; // Your Database user id


String dbPassWord = "password" ; // Your Database password


Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");


Connection con = DriverManager.getConnection("jdbc:odbc:myDriver",


dbUserid ,dbPassword );


Statement stmt = con.createStatement();


String sql= "select USERID from USERTABLE where USERID = "" +


inputUserid + "" and PASSWORD = "" + inputPwd +"" ;" ;


ResultSet rs = stmt.executeQuery(sql);


if (rs.next())


{


returnString = rs.getString("USERID");


}


stmt.close();


con.close();


return returnString ;


}



Tags:用户 登录 验证

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接