adminbusiness.java

来自「简单的员工管理」· Java 代码 · 共 82 行

JAVA
82
字号
package com.business;

import java.util.Vector;
import java.sql.*;

import com.bean.AdminBean;
import com.db.DBConnection;
import com.struts.form.AdminForm;

public class AdminBusiness implements IBusiness {

	public boolean findByName(Object ob)
	{
		DBConnection dbconn=DBConnection.getDBConnection();
		Connection conn=dbconn.getConn();
		String sql="select * from admins where aname=? and apass=?";
		PreparedStatement ps=null;
		ResultSet rst=null;
		//AdminBean ab=(AdminBean) ob;
		AdminForm ab=(AdminForm) ob;
		
		try {
			ps=conn.prepareStatement(sql);
			ps.setString(1, ab.getName());
			ps.setString(2, ab.getPass());
			rst=ps.executeQuery();
			if(rst.next())
			{
				return true;
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			try {
				if(rst!=null)
				{
					rst.close();
				}
				if(ps!=null)
				{
					ps.close();
				}
				if(conn!=null)
				{
					conn.close();
				}
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		
		}
		return false;
	}
	public boolean delete(String id) {
		// TODO Auto-generated method stub
		return false;
	}

	public Object findById(String id) {
		// TODO Auto-generated method stub
		return null;
	}

	public boolean save(Object ob) {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean update(Object ob) {
		// TODO Auto-generated method stub
		return false;
	}

	public Vector findAll() {
		// TODO Auto-generated method stub
		return null;
	}

}

⌨️ 快捷键说明

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