-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");
}
}