sectorbean.java
来自「《JSP程序设计实用教程》-梁建武-源代码-4567.rar」· Java 代码 · 共 38 行
JAVA
38 行
package com.saleSystem;
import java.util.*;
import java.io.*;
import java.sql.*;
import com.saleSystem.util.*;
/**
*PersonalImformationBean包含和Personal表相关的操作
*/
public class SectorBean
{
private Connection con;
//构造方法,获得数据库的连接。
public SectorBean()
{
this.con=DataBaseConnection.getConnection();
}
/**
*搜索所有的上销售员信息。
*返回由sector值对象组成的Collection
*/
public Collection getAllSector()throws Exception
{
Statement stmt=con.createStatement();
ResultSet rst=stmt.executeQuery("select * from sector");
Collection ret=new ArrayList();
while(rst.next())
{
Sector temp=new Sector();
temp.setName(rst.getString("name"));
temp.setProductCode(rst.getString("productCode"));
ret.add(temp);
}
con.close();
return ret;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?