📄 login.java
字号:
package com.am;
import java.lang.*;
import java.util.*;
import java.sql.*;
import java.text.*;
public class login extends user {
private String strSql;
private Connection dbConn;
private int errNum;
private String errDesc;
SimpleDateFormat dateFormatter;
public login() {
super();
strSql = "";
errNum = 0;
errDesc = "";
}
public boolean isValidUser() throws SQLException {
strSql = "select * from users ";
strSql = strSql + " where userName='" + userName + "'";
strSql = strSql + " and userPassword='" + userPassword + "'";
strSql = strSql + " and systemRole= '" + systemRole + "'";
Statement stmt=null ;
ResultSet rs=null ;
try{
stmt = dbConn.createStatement();
rs = stmt.executeQuery(strSql);
if (rs.next()) {
ID = rs.getLong("ID");
userName = rs.getString("userName");
userPassword = rs.getString("userPassword");
name = rs.getString("name");
company = rs.getString("company");
depart = rs.getString("depart");
email = rs.getString("email");
myfields = rs.getString("myfields");
systemRole = rs.getString("systemRole");
createDatetime = rs.getString("createDatetime");
tag = rs.getInt("tag");
this.errNum = 0;
this.errDesc = "";
return true;
} else {
this.errNum = -1;
this.errDesc = "Not Valid User";
return false;
}
}
catch(Exception ex)
{ this.errNum=-1;
this.errDesc=ex.toString();
return false;
}
finally{
}
}
public void setConnection(Connection dbConn) {
this.dbConn = dbConn;
}
public void exeSql(String strSql) {
try {
Statement stmt = dbConn.createStatement();
stmt.executeQuery(strSql);
this.errNum = 0;
this.errDesc = "";
} catch (Exception ex) {
this.errNum = -1;
this.errDesc = ex.toString();
}
}
public int getErrNum() {
return errNum;
}
public String getErrDesc() {
return errDesc;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -