try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url="jdbc:odbc:教务";
Connection con=DriverManager.getConnection(url);
Statement useset=con.createStatement();
String sql="update student set name='"
+jt[1].getText()+"'"+" and classnumber='"
+jt[2].getText()+"'"+" and sex='"
+jt[3].getText()+"'"+" and grade='"
+jt[4].getText()+"'"+" and zznum='"
+jt[5].getText()+"'"+" and peoplenum='"
+jt[6].getText()+"'"+" and bornnum='"
+jt[7].getText()+"'"+" and id='"
+jt[8].getText()+"'"+" and studynum='"
+jt[9].getText()+"'"+" and psw='"
+jt[10].getText()+"'"+" where number='"+jt[0].getText()+"'";
useset.executeUpdate(sql);
JOptionPane.showMessageDialog(null,"更新成功!");
jf.setVisible(false);
useset.close();
con.close();
}
catch(Exception ie)
{
ie.printStackTrace();
JOptionPane.showMessageDialog(null,"更新失败!","提示!",JOptionPane.ERROR_MESSAGE);
System.out.print("连接数据库失败!");
}
}
大家给我看看吧 为什么就是不能更新呢 jt[i].getText()表示我要输入更新的内容!