分享至
請問各位大大,小弟我目前使用mysql,想要抓取rsB的資料總數,請問要怎麼把count的值抓取出來?
Statement stmtB = con.createStatement();ResultSet rsB = stmtB.executeQuery("select count(*) from 菜單資料表 where 是否刪除 != 'N';
已邀請的邦友 {{ invite_list.length }}/5
如下:
Statement stmtB = con.createStatement(); ResultSet rsB = stmtB.executeQuery("select count(*) from 菜單資料表 where 是否刪除 != 'N'; while(rsB.next()) int count = rsB.getInt(1); or while(rsB.next()) int count = rsB.getInt("total");
可以抓取了!謝謝!
IT邦幫忙