我試圖讓這個查詢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
甲選擇不具有數受影響的行(==添加,更新或刪除)。 –