📄 disppaytype.java
字号:
/**
* Title 财务管理系统
* @author: trowa
* Company: http://www.upol.cn
* Copyright: Copyright (c) 2004
* @version 1.0
* 费用类型表中的一些查询操作
*/
package caiwu;
import java.sql.*;
import java.util.*;
public class DispPaytype extends Paytype{
public ResultSet rs;
//得到所有的费用类型
public Vector allPaytype(){
DBConnect dbc = null;
Vector allPaytypeVector = new Vector();
try{
dbc = new DBConnect();
dbc.prepareStatement("SELECT * FROM paytype order by id");
rs = dbc.executeQuery();
while(rs.next()){
Paytype paytype = new Paytype();
paytype.setId(rs.getInt("id"));
paytype.setName(rs.getString("name"));
paytype.setInout(rs.getInt("inout"));
allPaytypeVector.add(paytype);
}
}catch(Exception e){
System.err.println(e);
}finally{
try{
dbc.close();
}catch(Exception e){
e.printStackTrace();
}
}
return allPaytypeVector;
}
//根据支出和收入获得所有的费用类型
public Vector inoutPaytype(){
DBConnect dbc = null;
Vector allPaytypeVector = new Vector();
try{
dbc = new DBConnect();
dbc.prepareStatement("SELECT * FROM paytype where inout=? order by id");
dbc.setInt(1,Inout);
rs = dbc.executeQuery();
while(rs.next()){
Paytype paytype = new Paytype();
paytype.setId(rs.getInt("id"));
paytype.setName(rs.getString("name"));
paytype.setInout(rs.getInt("inout"));
allPaytypeVector.add(paytype);
}
}catch(Exception e){
System.err.println(e);
}finally{
try{
dbc.close();
}catch(Exception e){
e.printStackTrace();
}
}
return allPaytypeVector;
}
//根据id得到所有的费用类型
public Paytype idToPaytype(){
DBConnect dbc = null;
Paytype paytype = new Paytype();
try{
dbc = new DBConnect();
dbc.prepareStatement("SELECT * FROM paytype where id=?");
dbc.setInt(1,Id);
rs = dbc.executeQuery();
if(rs.next()){
paytype.setId(rs.getInt("id"));
paytype.setName(rs.getString("name"));
paytype.setInout(rs.getInt("inout"));
}
}catch(Exception e){
System.err.println(e);
}finally{
try{
dbc.close();
}catch(Exception e){
e.printStackTrace();
}
}
return paytype;
}
public DispPaytype() {
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -