All pastes #983837 Raw Edit

sangprabo

public java v1 · immutable
·published 2008-04-13 17:48 UTC
rendered paste body
String[][] readMultipleRowsWithID(int numOfRows){        int i,j;        i = j =0;        String[][] returnDataRows = new String[numOfRows][4];        try {            if (store.getNumRecords() >0){ // it means the record store is not empty                RecordEnumeration re = store.enumerateRecords(null, null, false);                while (re.hasNextElement() && (i < numOfRows)){                                        if ((j%3) == 0)                        returnDataRows[i][3] = new String(re.nextRecord());//get the Amount value                    else if (j%3 == 1)                        returnDataRows[i][2] = new String(re.nextRecord());//get the Date value                    else {                        returnDataRows[i][0] = new String(String.valueOf(re.nextRecordId()));//get the 'rowID' value                        re.previousRecordId(); //set the pointer back                        returnDataRows[i][1] = new String(re.nextRecord());//get the Name value                    }                    if ((j%3) == 2)                        i++;                    j++;                }                re.destroy();            }            return returnDataRows;        }catch (Exception e){            return returnDataRows;        }            }