My code is not working for some reason - the first two in the prepared statement work easily, but the third gives me an error and tells me to comment out the disruption. I've double-checked the database and all looks well there, so why is the third giving me a syntax error?
username = jTextField_user.getText(); String pwd = String.valueOf(jPasswordField.getPassword()); Connection con = DBConnection.getConnection(); //query database String query = "SELECT * FROM users WHERE username=? AND password=? AND type=?"; try{ //initialise the query for sending, prepares statement to send to DB PreparedStatement ps = con.prepareStatement(query); ps.setString(1,username); ps.setString(2, pwd); ps.setString(3,type); ResultSet rs = ps.executeQuery();
https://stackoverflow.com/questions/67310906/why-are-my-first-two-prepared-statements-working-but-not-my-third-the-queries April 29, 2021 at 12:06PM
没有评论:
发表评论