www.pudn.com > BeiJie.rar > LoginOperation.java


package operation; 
 
import java.sql.ResultSet; 
 
import dataBase.DataBase; 
 
public class LoginOperation 
{ 
	public LoginOperation() 
	{ 
		db = new DataBase(); 
	} 
	 
	// 登录查询,看用户输入的用户名密码是否存在数据库中 
	public String Check(String userID,String password) 
	{ 
		sql = "select * from EmployeeInfo where EmployeeName = '"+userID+"' and Password = '"+password+"'"; 
		rs = db.getResult(sql); 
		try 
		{ 
			if(rs.next()) 
			{ 
				employeeClass = rs.getString("employeeClass"); 
			} 
		} 
		catch(Exception e) 
		{ 
			e.printStackTrace(); 
		} 
		return employeeClass; 
	} 
	//	关闭连接 
	public void close() 
	{ 
		db.close(); 
	} 
	private DataBase db = null; 
	private String sql = ""; 
	private ResultSet rs = null; 
	private String employeeClass = ""; 
}