⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 disppaytype.java

📁 通过jsp、mysql实现了进销存管理
💻 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.setIo(rs.getInt("io"));
				allPaytypeVector.add(paytype);
			}
		} catch (Exception e) {
			System.err.println(e);
		} finally {
			try {
				dbc.close();
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
		return allPaytypeVector;

	}

	// 根据支出和收入获得所有的费用类型
	public Vector ioPaytype() {
		DBConnect dbc = null;
		Vector allPaytypeVector = new Vector();
		try {
			dbc = new DBConnect();
			dbc
					.prepareStatement("SELECT * FROM paytype where io=? order by id");
			dbc.setInt(1, Io);
			rs = dbc.executeQuery();
			while (rs.next()) {
				Paytype paytype = new Paytype();
				paytype.setId(rs.getInt("id"));
				paytype.setName(rs.getString("name"));
				paytype.setIo(rs.getInt("io"));
				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.setIo(rs.getInt("io"));
			}
		} 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 + -