pettype.java~8~
来自「一个基于JAVA的BS结构的宠物诊所管理系统.是当年在学校时写的,大家指点一下.」· JAVA~8~ 代码 · 共 60 行
JAVA~8~
60 行
package gxaccp.t07.guoneng_wei.petclinicmanagesystem.bean;
import java.sql.*;
import java.util.Vector;
import gxaccp.t07.guoneng_wei.jdbc.DataBaseAccess;
public class PetType {//宠物类型
private String id;
private String petTypeName;
public PetType() {
}
public void setId(String id) {
this.id = id;
}
public void setPetTypeName(String petTypeName) {
this.petTypeName = petTypeName;
}
public String getId() {
return id;
}
public String getPetTypeName() {
return petTypeName;
}
public synchronized static Vector getPetType() {
String select = "SELECT * FROM PetTypeInfo";
Connection con =DataBaseAccess.getConnection();
PreparedStatement pst = null;
ResultSet rs = null;
try {
Vector v = new Vector();
pst=con.prepareStatement(select);
rs=pst.executeQuery();
while (rs.next()) {
PetType pt = new PetType();
pt.setId(rs.getString("ID"));
pt.setPetTypeName(rs.getString("PetTypeName"));
v.addElement(pt);
}
return v;
}
catch (SQLException ex) {
System.out.println("!!!!!!!!!异常出现在获取宠物类型时的getPetType方法里!!!!!!!!!");
}
finally {
DataBaseAccess.closeResultSet(rs);
DataBaseAccess.closeStatement(pst);
DataBaseAccess.closeConnection(con);
}
return null;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?