?? 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;
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -