📄 pettype.java~17~
字号:
package gxaccp.t07.guoneng_wei.petclinicmanagesystem.beans;
import java.io.*;
import java.util.Vector;
import java.sql.Connection;
import java.sql.*;
import gxaccp.t07.guoneng_wei.jdbc.DataBaseAccess;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class PetType
implements Serializable {
private String id="";//宠物类型编号
private String petTypeName="";//宠物类型名
public PetType() {
}
public String getId() {
return id;
}
public String getPetTypeName() {
return petTypeName;
}
public void setId(String id) {
this.id = id;
}
public void setPetTypeName(String petTypeName) {
this.petTypeName = petTypeName;
}
public 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;
}
public boolean addNewPetType(){
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -