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

📄 feedbackrecordjpanel.java

📁 JAVA实现的酒店管理系统
💻 JAVA
字号:
package file1;

/*
 * @Author:黄顺武
 * Description:客户申诉记录的反馈情况的显示面版
 * Create Time:2008-2-2
 */
import javax.swing.*;
import java.sql.*;
import sun.jdbc.rowset.*;

public class FeedBackRecordJPanel extends JPanel {

	private JTable recTable = null;
	private JScrollPane recScrollPane = null;
	private String[] head = { "记录编号", "申诉记录编号", "操作人", "操作时间", "建议" };// 表格的标题
	private String[][] data = null;// 表格的数据
	private int headNum = 0;// 表格标题的列数
	private DBConnection con = null;// 数据库联接操作类

	public FeedBackRecordJPanel(int id) {
		headNum = head.length;
		con = new DBConnection();
		String sqlStr="";
		if(id==0){//总体查询
			sqlStr="select FeedBackRecord.ID,AppealID,name,OperateTime,Suggestion from FeedBackRecord,Employee where OperaterID=Employee.ID";
		}else if(id>0){//条件查询
			sqlStr = "select FeedBackRecord.ID,AppealID,name,OperateTime,Suggestion from FeedBackRecord,Employee where OperaterID=Employee.ID and FeedBackRecord.ID="+id;
		}
		try {
			if(sqlStr.equals("")){//sql语句拼写有误 
				JOptionPane.showMessageDialog(null, "查询条件有误!", "",
						JOptionPane.INFORMATION_MESSAGE); 
				return;
			}
			CachedRowSet crs = con.getResultSet(sqlStr);
			int totalRecord = 0;// 记录总的记录数
			while (crs.next()) {
				totalRecord++;
			}
			data = new String[totalRecord][headNum];
			crs.beforeFirst();
			totalRecord = 0;
			while (crs.next()) {
				data[totalRecord][0] = String.valueOf(crs.getInt(1));
				data[totalRecord][1] = String.valueOf(crs.getInt(2));
				data[totalRecord][2] = crs.getString(3).trim();
				data[totalRecord][3] = crs.getString(4).trim();
				data[totalRecord][4] = crs.getString(5).trim();
				totalRecord++;
			}
			recTable = new JTable(data, head);
			recScrollPane = new JScrollPane(recTable);
			this.add(recScrollPane);
		} catch (ClassNotFoundException cnfe) {
			JOptionPane.showMessageDialog(null, "发生ClassNotFound错误!", "",
					JOptionPane.INFORMATION_MESSAGE);
		} catch (SQLException sqle) {
			JOptionPane.showMessageDialog(null, "发生Sql错误!", "",
					JOptionPane.INFORMATION_MESSAGE);
		}
	}
}

⌨️ 快捷键说明

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