Well, we originally had it setup as a do loop. We don't really need to know the number of records, however, the NumRows equaled DB_ROWSUNKNOWN unless we moved to the LastRow. The For Next loop was used as an alternative way to try to get this program to work. The original program did this. Update records on AS/400 where flag = blank to a 1. Select records on AS/400 where flag = 1 qresult.execute qresult.firstrow Do ... do stuff qresult.nextrow Loop Until IsEndOfData Update records on as/400 where flag = 1 to a 2 This worked fine reading through the records. But then we decided that we'd like to update that row with a value before reading the next row instead of issuing the update SQL statements twice. But when we entered the SetValue() and UpdateRow commands before the NextRow command, the loop would only occur once. We found out that NumRows was equal to -1 (DB_ROWSUNKNOWN), so we added the code to go to the LastRow. NumRows then equaled 30. ----------------- Sean, thanks for the reply. We'll give that a try too. Michael Schutte David Leedy <DLeedy@xxxxxxxxx om> To Sent by: domino400@xxxxxxxxxxxx domino400-bounces cc +michael_schutte= bobevans.com@midr Subject ange.com Re. Fw: Issue with AS/400 data being updated from Lotus Notes Script. 04/28/2006 09:18 AM Please respond to Lotus Domino on the iSeries / AS400 <domino400@midran ge.com> Michael, I'm not sure why you're program is behaving that way... but I've never navigated through a resultset in this manner with a for loop... I always use a do loop... Is there a reason why you need to know the number of rows ahead of time rather then just keeping a counter going from the beginning? David .... .... Set result.query = qry qry.sql = "CALL WEB.WEBUNDLVR5('" & uname & "', "& code1 & ")" result.execute Do result.nextrow ... ... ... rowno=rowno+1 Loop Until result.isendofdata _______________________________________________ This is the Lotus Domino on the iSeries / AS400 (Domino400) mailing list To post a message email: Domino400@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/domino400 or email: Domino400-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/domino400.
As an Amazon Associate we earn from qualifying purchases.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.