-2
我想从数据库(bill_number)获取最大值并将其设置为jtextfield。但我得到错误(void类型不允许在这里)。从数据库中获取最大值并设置为jtextfield
哪里是问题,我的代码
public void number(){
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection cn = DriverManager.getConnection("Jdbc:Odbc:ds_comboPractice");
String sql = "select count(Bill_Number)=? from combopractice";
PreparedStatement pst = cn.prepareStatement(sql);
pst.setString(1, txt4.setText(sql));
pst.executeQuery();
cn.close();
}
catch(ClassNotFoundException ex){
JOptionPane.showMessageDialog(this, "Class not found");
}
}