开发者

creating and filling array from select statements

I am kinda new to this, but I am trying to fill an ar开发者_StackOverflowray from a sql statement that pulls several permit numbers from a table.

So in the table every person can have multiple permits, I need to store all the permit numbers and display them in a drop down box via javascript. I have been able to get at least the first permit, but nothing after that. I know this person has more than one. here is the code I have:

 ResultSet rsTagCheck = stmt.executeQuery("SELECT PARK.XK.XK_PI, PARK.XK.XK_STAT, PARK.XK.XK_EX_YR, PARK.XK.XK_TAG FROM PARK.XK WHERE XK_PI ='" + ID + "'");
        if (rsTagCheck.next()){
           String TagNum = rsTagCheck.getString("XK_TAG");
           String[] tag = new String[101];
           for (int i = 0; i < tag.length; i++)
               tag[i] = TagNum;

Any help would be greatly appreciated. Thanks


You have to iterate over the ResultSet rsTagCheck. I never used it, but something on the lines of

while (rsTagCheck.next()) {
     ...your code here...
}

should work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜