\\\
31 / 50
刘刘
佳丹
宇丹
} }
}
}
new Chuangkou();
System.out.println(\请选择操作\ dispose();
else{ }
System.out.print(\输入错误\
查找模块程序设计: //chazhao.java package com.test; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.Vector;
import javax.swing.table.*;
public class Chazhao extends AbstractTableModel{
Vector rowData,columnNames; PreparedStatement ps=null; Connection ct=null; ResultSet rs=null;
public void init(String sql) {
if(sql.equals(\ {
sql=\成绩表\
32 / 50
} //中间
columnNames=new Vector(); //设置列名
columnNames.add(\
columnNames.add(\学号\
columnNames.add(\姓名\
columnNames.add(\出生\ columnNames.add(\数学\ columnNames.add(\英语\ rowData=new Vector();
try {
Class.forName( \
ct=DriverManager.getConnection( \翰林学院学生成绩管理系统\ ps=ct.prepareStatement(sql); rs=ps.executeQuery();
33 / 50
while(rs.next()) { }
}catch (Exception e) { e.printStackTrace(); }finally{ //关闭 try {
if(rs!=null) rs.close(); if(ps!=null) ps.close(); if(ct!=null) ct.close();
34 / 50
Vector hang=new Vector();
//加入rowdata rowData.add(hang); hang.add(rs.getInt(1)); hang.add(rs.getString(2)); hang.add(rs.getString(3)); hang.add(rs.getString(4)); hang.add(rs.getInt(5)); hang.add(rs.getString(6));
}catch(Exception e) {
e.printStackTrace();
} } }
public Chazhao(String sql) { }
public Chazhao() { }
public int getColumnCount() { }
public int getRowCount() { }
35 / 50
this.init(sql);
this.init(\
return this.columnNames.size();
return this.rowData.size();