0
MySQL to java
How do i write SELECT debt FROM client where dni =? On java? Is it okay public boolean isDebtbyDNI(String dni) { PreparedStatement stat = null; ResultSet rs = null; Connection con = connection.getConexion(); boolean debt = false; try { stat = con.prepareStatement("SELECT debt FROM client where dni =?"); stat.setString(1, dni); rs = stat.executeQuery(); while (rs.next()) { debt = rs.getBoolean("debt"); } return debt; } //etc etc catchs under there
2 Answers
+ 1
You have to escape your line breaks and execute the statement, then yes as far as I can see (quick look).
0
will that give me the same result as "SELECT debt FROM client where dni = something"