When I select a particular combobox item i want to enter null values in the database so that I can get the rowcount for that column leaving the null row
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"));
}
I have tried above but it’s showing for inputstring “null” error.
similarly you need to check for rm_id