daocstlostdao.java

来自「J2EE客户关系管理系统!!!!!!!!!!!!!!!!!!!!」· Java 代码 · 共 59 行

JAVA
59
字号
package com.accp.DAO;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.accp.VO.VOCstLostVO;
import com.accp.DB.DBConnection;


public class DAOCstLostDAO {
	public List<VOCstLostVO> findBy(String str){
		List ls = new ArrayList();
		Connection con = DBConnection.getConnection();
		PreparedStatement ps = null;
		ResultSet rs = null;
		String sql = "select lst_cust_name from cst_lost where 1=1 and lst_cust_name like '%"+str+"%'";
		try {
			ps = con.prepareStatement(sql);
			rs = ps.executeQuery();
			while(rs.next()){
				VOCstLostVO cstlostvo = new VOCstLostVO();
				cstlostvo.setLstCustName(rs.getString(1));
				ls.add(cstlostvo);
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}finally{
			DBConnection.ConnectionClose(con);
		}
		return ls;
	}
	
	public List<VOCstLostVO> findBy1(){
		List ls = new ArrayList();
		Connection con = DBConnection.getConnection();
		PreparedStatement ps = null;
		ResultSet rs = null;
		String sql = "select lst_cust_name from cst_lost where 1=1";
		try {
			ps = con.prepareStatement(sql);
			rs = ps.executeQuery();
			while(rs.next()){
				VOCstLostVO cstlostvo = new VOCstLostVO();
				cstlostvo.setLstCustName(rs.getString(1));
				ls.add(cstlostvo);
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}finally{
			DBConnection.ConnectionClose(con);
		}
		return ls;	
	}
}

⌨️ 快捷键说明

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