我正在尝试检查数据库中是否存在记录,但我不确定如何执行此查询,它给出了 executeQuery(checkSql) 错误。你能帮我吗?
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);
}