我试图让这个查询SELECT mac, stop_name from behaviour where mac = ?
与使用executeQuery
的受影响的记录数的数量。我怎样才能得到受影响的行数?获取受影响的行
代码:
if (behaviourExist.next()) {
PreparedStatement prepared = con
.prepareStatement("SELECT mac, stop_name from behaviour where mac = ?");
prepared.setString(1, macD);
ResultSet rsBehav = prepared.executeQuery();
ArrayList<String> stopNameList = new ArrayList<String>();
while (rsBehav.next()) {
//int numberOfRows = rsBehav.getInt(1);
String stNa = rsBehav.getString("stop_name");
if (stNa.equals(nameShortestDistance)) {
stopNameList.add(stNa);
}
}
}
http://www.coderanch.com/t/303346/JDBC/databases/find-number-rows-resultset – Pshemo
甲选择不具有数受影响的行(==添加,更新或删除)。 –