当我选择一个特定的组合框项目时,我想在数据库中输入空值,以便我可以获得该列的行数,留下空行
String bnn = (txtboxno.getText().trim() == null ||
txtboxno.getText().equals("")) ? "null" : txtboxno.getText();
Object nsn = (cbnotstat.getSelectedItem() == null || cbnotstat.getSelectedItem().equals("")) ? "0" : cbnotstat.getSelectedItem();
PreparedStatement stmt = con.prepareStatement("select COUNT(box_no)as total from soil_det WHERE rm_id = ?");
ResultSet rs;
String rm = tf_rm_id.getText();
stmt.setLong(1, Long.parseLong(rm));
rs = stmt.executeQuery();
while (rs.next()) {
tf_boxno.setText(rs.getString("total"));
}
我在上面尝试过,但它显示输入字符串“null”错误。