日期:2014-05-17 浏览次数:20416 次
public void actionPerformed(ActionEvent e) {
try {
String strurl =
"jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=DataBase/student.mdb";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection(strurl);
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("select 学号 from BaseInf where 学号='" +
textField1.getText() + "'");
if (rs.next()) {
JOptionPane.showMessageDialog(null, "此学号已经被注册.", "警告",
JOptionPane.WARNING_MESSAGE);
return;