电脑故障

位置:IT落伍者 >> 电脑故障 >> 浏览文章

用户登录的验证完整程序


发布日期:2018/5/19
 

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

ClassforName(sunjdbcodbcJdbcOdbcDriver);

Connection con = DriverManagergetConnection(jdbc:odbc:myDriver

dbUserid dbPassword );

Statement stmt = concreateStatement();

String sql= select USERID from USERTABLE where USERID = +

inputUserid + and PASSWORD = + inputPwd + ; ;

ResultSet rs = stmtexecuteQuery(sql);

if (rsnext())

{

returnString = rsgetString(USERID);

}

stmtclose();

conclose();

return returnString ;

上一篇:Swing之JTable运用线程一个测试

下一篇:JVM平台开发语言 一直在流行