错误 mysql 未找到

Err mysql not found

PreparedStatement codePull = (PreparedStatement) con.prepareStatement("SELECT tanCode FROM `tancodes` WHERE (tanIndex= "+Tindex+")");
        ResultSet DbTcode = codePull.executeQuery();
        String answer = DbTcode.getString("");
        return answer;

这是我正在使用的代码,但问题是我收到一条错误消息: 错误:java.sql.SQLException:未找到列“”。

但我可以看到它确实存在于Table!

有什么解决办法吗??

试着这样写你的查询:

 "SELECT tanCode FROM tancodes WHERE tanIndex= '"+Tindex+"'"

并在此处写下列的名称:

 DbTcode.getString("tanCode");// for example

因为"it is: "不是列名