Storing Result set into an array

前端 未结 2 1243
闹比i
闹比i 2020-12-17 00:51

i know this should be simpel and im probably staring straight at the problem but once again im stuck and need the help of the code gurus.

im trying too take one row

2条回答
  •  别那么骄傲
    2020-12-17 01:36

    Did you mean something like:

    int i = 0;
    ResultSet rs = stmt.executeQuery("select name from users");
    while (rs.next()) {
        String name = rs.getString("name");
        names[i++] = name;
    }
    

提交回复
热议问题