java如何将结果集保存到变量中?
您好,我已经搜索了几个关于如何将结果集中的值保存在变量中的问题。由于我使用的是函数,我不知道在ResultSetVar中放入什么。getString(“”)函数
这是我的问题
sqlSelectRecord1 = "SELECT COUNT(name) as acount from maintable where VLdate = ?";
psSelectRecord1=conn.prepareStatement(sqlSelectRecord1);
psSelectRecord1.setString(1, strDateofVL);
rsSelectRecord1=psSelectRecord1.executeQuery();
String strCount;
Integer iCount;
while (rsSelectRecord1.next()) {
strCount = rsSelectRecord1.getString(acount);
iCount = Integer.valueOf(strCount);
}
我有一个错误,说明无法将帐户解析为变量。我猜它在我的查询中没有把我的读作帐户。我该如何度过这一关
# 1 楼答案
你必须使用一个名字