reader.java

来自「学习jsp时做的一个书馆」· Java 代码 · 共 41 行

JAVA
41
字号
 package library;
import java.sql.*;
public class Reader {
    private String  ReaderID = "";
    private String  passwd = "";
  
    public Reader(String ID,String pd) throws Exception{
    	ReaderID = ID;
    	passwd = pd;
    	//check(ReaderID);
    }
    
    public void check(String id)throws Exception{
    	
		
    } 
    public boolean isLogin()throws Exception {
		
	    DBConnection myConnection = DBConnection.Instance();
		String sqlQuery = "select * from reader where ReaderID='" + this.ReaderID +"' and password = '"+this.passwd+ "'";
		ResultSet r = null;
		
		r = myConnection.runQuery( sqlQuery );
		if (r.next()){
			r.close();
           return true;
		}else{
		   return false;   
		}
		
    }
    
    public String getRaderID() throws Exception{
    	if(this.isLogin())
    	    return ReaderID;
    	else
    		return null;
    }
   
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?