I am trying to check if a record exist in a database and I am not sure how to execute this query, It gives error with executeQuery(checkSql). Can you help me, please?
public void addScore(int score, String name)
{
try {
con = mgr.getConnection();
String checkSql = "if EXISTS (select * from HIGHSCORES where name = '"+name+"')";
Statement st = con.createStatement();
//ResultSet result = st.executeQuery(checkSql);
} catch (SQLException e) {
e.printStackTrace();
}
mgr.closeConnection(con);
}