>oData.P1 = 10 >oData.P2 = 24 >oData.P3 = 76 >etc. >>In the ASP page I want to write a loop that accesses this data, such as:
>for i = 1 to n > dataprop = "oData.P" + transform(i) > myvar = &dataprop > do something with myvar . . . >next >>This would be easy in VFP but how would you do it in ASP?
<table width=1000 border="1" cellspacing="2" cellpadding="1" style="font-size:9pt"> <TBODY> <tr class="tblHeaderBackground"> <th>QPR #</th> <th>Supplier Name</th> <th>Part Name</th> <th>Problem</th> <th>Created</th> <th>Notification Date</th> <th>Notified By</th> <th>QCE Signature</th> <th>QCE AM</th> <th>Temp C/M receipt date</th> <th>Perm C/M receipt date</th> <th>Report Correction</th> </tr> < % dim intRow dim intDisplayRows dim intPageSize dim intCurrentPage dim intPage dim intBookMark dim intRecord dim intInitialRecord ' dim iPage dim TotalPages dim iRec dim sMe dim sQuote dim sQueryString sQuote = Chr(34) ' double quote character... ' Set reference to which Page we are on... sQueryString = Request.QueryString("PAGE") ' testing...6-30-2000 'iPage = Request.QueryString("PAGE") 'Response.Write "<div style=position: relative; top: 250px; left: 5px;><h3>Page " & iPage & " of " & oProj.PageCount & "</H3>" ' Initial page... ' 09-12-2000 'If iPage = "" Then ' iPage = 1 'End If ' 08-03-2000 Causes error... oRS.AbsolutePage = iPage For iRec = 1 To oRS.PageSize If Not oRS.EOF Then If x = 1 then x = 0 Response.Write "<tr class=""tblEvenRowBackground"">" & vbcrlf Else Response.Write "<tr class=""tblOddRowBackground"">" & vbcrlf x = 1 End If Response.Write "<td width=70>" & "<A title=""Select this record"" HREF=QPRDetailE.asp?proj_id=" _ & oRS("QPRPK") & ">" & oRS("QPRNumber") & "</A></td>" & vbcrlf Response.Write "<td width=100>" & left(oRS("SupplierName"),10) & "</td>" & vbcrlf Response.Write "<td width=150>" & left(oRS("PartName"),15) & "</td>" & vbcrlf Response.Write "<td width=100>" & left(oRS("Problem"),10) & "</td>" & vbcrlf Response.Write "<td width=160>" & left(oRS("DateCreated"),28) & "</td>" & vbcrlf Response.Write "<td width=60>" & left(oRS("NotificationDate"), 10) & "</td>" & vbcrlf ' 04-07-2006 Response.Write "<td width=60>" & left(oRS("NotifiedBy"), 10) & "</td>" & vbcrlf Response.Write "<td width=100>" & oRS("QCESignature") & "</td>" & vbcrlf ' 09-16-2005 Response.Write "<td width=100>" & oRS("TMCSignature") & "</td>" & vbcrlf Response.Write "<td width=60>" & left(oRS("DueDate"), 10) & "</td>" & vbcrlf Response.Write "<td width=60>" & left(oRS("ReplyReceived"), 10) & "</td>" & vbcrlf Response.Write "<td width=130>" & oRS("ReportCorrection") & "</td>" & vbcrlf oRS.MoveNext End If Next Response.Write "</TBODY></table>" '& vbcrlf sMe = Request.ServerVariables("SCRIPT_NAME") 'Response.Write "<div style=position: absolute; top: 250px; left: 5px;><h3>Page " & iPage & " of " & oProj.PageCount & "</H3>" 'Response.Write "<span><h3>of " & oProj.PageCount & "</span></H3>" 'Response.Write "<p></p>" ' SPAN was used style=position: absolute; top: 250; left: 5; 'Response.Write "<span style=position: absolute; top: 250; left:5 >" ' This code is used for testing... ' 01-13-2005 ' The code below was modified. Response.Write "<div id=""test"" style=""position: absolute; top: 0; left: 5 "">" If iPage = 1 Then '''' Response.Write " <A HREF=" & sQuote & sMe & "?PAGE=1" & "&Sort=" & sSort & "&Status=" & sStatus & sQuote & sQuote & ">First Page </A>" '''' Response.Write " <A HREF=" & sQuote & sMe & "?PAGE=" & iPage -1 & "&Sort=" & sSort & "&Status=" & sStatus & sQuote & sQuote & ">Previous Page</A>" Response.Write " <span>First Page </span>" Response.Write " <span>Previous Page</span>" Else Response.Write " <A HREF=" & sQuote & sMe & "?PAGE=1" & "&Sort=" & sSort & "&Status=" & sStatus & sQuote & sQuote & ">First Page </A>" Response.Write " <A HREF=" & sQuote & sMe & "?PAGE=" & iPage -1 & "&Sort=" & sSort & "&Status=" & sStatus & sQuote & sQuote & ">Previous Page</A>" ' Response.Write " <A HREF=" & sQuote & sMe & "?PAGE=1" & "&Sort=" & sSort & sQuote & ">First Page </A>" ' Response.Write " <A HREF=" & sQuote & sMe & "?PAGE=" & iPage -1 & "&Sort=" & sSort & sQuote & sQuote & ">Previous Page</A>" End If If oRS.EOF Then Response.Write " <span>Next Page</span>" Response.Write " <span>Last Page</span>" Else Response.Write " <A HREF=" & sQuote & sMe & "?PAGE=" & iPage +1 & "&Sort=" & sSort & "&Status=" & sStatus & sQuote & sQuote & ">Next Page</A>" Response.Write " <A HREF=" & sQuote & sMe & "?PAGE=" & oRS.PageCount & "&Sort=" & sSort & "&Status=" & sStatus & sQuote & sQuote & ">Last Page</A>" '''' Response.Write " <A HREF=" & sQuote & sMe & "?PAGE=" & iPage +1 & "&Sort=" & sSort & sQuote & sQuote & ">Next Page</A>" '''' Response.Write " <A HREF=" & sQuote & sMe & "?PAGE=" & oRS.PageCount & "&Sort=" & sSort & "&Status=" & sStatus & sQuote & sQuote & ">Last Page</A>" ' Response.Write " <A HREF=" & sQuote & sMe & "?PAGE=" & iPage +1 & "&Sort=" & sSort & sQuote & sQuote & ">Next Page</A>" ' Response.Write " <A HREF=" & sQuote & sMe & "?PAGE=" & oRS.PageCount & "&Sort=" & sSort & sQuote & sQuote & ">Last Page</A>" End If ' 01-13-2005 ' The code above was modified. if llOK then Response.Write "<div id=""test"" style=""position: absolute; top: 0; left: 0 "">" If iPage = 1 Then Response.Write " <span>First Page </span>" Response.Write " <span>Previous Page</span>" Else Response.Write " <A HREF=" & sQuote & sMe & "?PAGE=1" & "&Sort=" & sSort & sQuote & ">First Page </A>" Response.Write " <A HREF=" & sQuote & sMe & "?PAGE=" & iPage -1 & "&Sort=" & sSort & sQuote & sQuote & ">Previous Page</A>" End If If oRS.EOF Then Response.Write " <span>Next Page</span>" Response.Write " <span>Last Page</span>" Else Response.Write " <A HREF=" & sQuote & sMe & "?PAGE=" & iPage +1 & "&Sort=" & sSort & sQuote & sQuote & ">Next Page</A>" Response.Write " <A HREF=" & sQuote & sMe & "?PAGE=" & oRS.PageCount & "&Sort=" & sSort & "&Status=" & sStatus & sQuote & sQuote & ">Last Page</A>" ' Response.Write " <A HREF=" & sQuote & sMe & "?PAGE=" & iPage +1 & "&Sort=" & sSort & sQuote & sQuote & ">Next Page</A>" ' Response.Write " <A HREF=" & sQuote & sMe & "?PAGE=" & oRS.PageCount & "&Sort=" & sSort & sQuote & sQuote & ">Last Page</A>" End If end if Response.Write "</div>" % >The code above allows Paging of data. You can define how many reords will be allowed on one page.