从ResultSet JDBC中找不到符号 [英] Cannot find symbol from ResultSet JDBC
本文介绍了从ResultSet JDBC中找不到符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我遇到一个找不到符号错误,它指向rs.getChars(1)
中的句点.此代码都在try{}
内.
I'm getting a cannot find symbol error and it points to the period right in rs.getChars(1)
This code is all within a try{}
.
视图表中有三列,标题,item_id和名称.我只是在尝试查询它,但是在while循环开始的那一行上得到了一个找不到符号.
There are three columns in the view table, title, item_id, and name. I'm just trying to query it but get a cannot find symbol on the line inside the start of the while loop.
PreparedStatement pstmt=
conn.prepareStatement("SELECT * FROM Film_Sound_Track");
ResultSet rs = pstmt.getResultSet();
while(rs.next()){
char item_id = rs.getChars(1);
}
rs.close();
pstmt.close();
推荐答案
java.sql.ResultSet
没有方法getChars
.您可以使用getString
方法检索String
,然后从中提取char
:
java.sql.ResultSet
does not have a method getChars
. You could use the getString
method to retrieve a String
and then extract the char
from it:
char item_id = rs.getString(1).charAt(0);
这篇关于从ResultSet JDBC中找不到符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文