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

📄 docbean.java

📁 这是一个很好用的软件
💻 JAVA
字号:
package oa.bean;

import java.sql.*;
import oa.main.*;

public class DocBean extends ParentBean {

	public DocBean() throws Exception {
	}

	public int getMaxValue(String table, String value) {
		String strSQL = "select " + value + " as maxvalue from news." + table
				+ " where " + value + "=(select max(" + value + ") from "
				+ table + ")";
		ResultSet rs = db.QuerySQL(strSQL);
		int rValue;
		rValue = 0;
		Statement stmt = null;
		try {
			while (rs.next()) {
				rValue = Integer.parseInt(rs.getString("maxvalue"));
			}
		} catch (Exception e) {
			System.out.println("运行时出错:" + e);
		} finally {
			if (rs != null)
				try {
					stmt = rs.getStatement();
					rs.close();
				} catch (Exception e) {
					System.out.println("关闭记录集rs时出错" + e);
				}
			if (stmt != null)
				try {
					stmt.close();
				} catch (Exception e) {
					System.out.println("关闭声明时statement出错" + e);
				}
		}
		return rValue;
	}

	public int getConMaxValue(String sql) {
		ResultSet rs = db.QuerySQL(sql);
		int rValue = 0;
		Statement stmt = null;
		try {
			if (rs.next()) {
				rValue = Integer.parseInt(rs.getString(1));
			}
		} catch (Exception e) {
			System.out.println("运行时出错:" + e);
		} finally {
			if (rs != null)
				try {
					stmt = rs.getStatement();
					rs.close();
				} catch (Exception e) {
					System.out.println("关闭记录集rs时出错" + e);
				}
			if (stmt != null)
				try {
					stmt.close();
				} catch (Exception e) {
					System.out.println("关闭声明时statement出错" + e);
				}
		}
		return rValue;
	}

	public void ExecuteSQL(String sql) {
		db.ExecuteSQL(sql);
	}

	public ResultSet QuerySQL(String sql) {
		ResultSet rs = db.QuerySQL(sql);
		return rs;
	}

	public void close() {
		closeRs();
		closePstm();
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -