How come this snippet of code throws a SQL Exception stating that "No data was found!":
(r is aResultSet, sb is a StringBuffer)
While this one works fine:
leo
------------
Leo Mendoza
lmendoza-at-garbersoft-dot-net
(r is aResultSet, sb is a StringBuffer)
Code:
if(r.next()) { //advance to first record
//iterate through the records, looking for matches
//sb.append(r.getInt("StartHour") + ":" + r.getInt("StartMinute") + "<br />");
for(int i = 7; i<=18; i++) { //go from 7:00GMT to 18:00GMT
if(r.getInt("StartHour") == i) {
do (r.next()) { //so that the first one always gets executed
sb.append(r.getInt("StartHour") + ":" +
r.getInt("StartMinute") + " - - " +
r.getString("EventDesc") + "<br />");
} while (r.next());
} else sb.append("<br />empty row: " + i );
} //end for
} //end if
While this one works fine:
Code:
while(r.next()) { //advance to first record
//iterate through the records, looking for matches
sb.append(r.getInt("StartHour") + ":" + r.getInt("StartMinute") + "<br />");
} //end if
------------
Leo Mendoza
lmendoza-at-garbersoft-dot-net