Results 1 to 5 of 5

Thread: Looping thru results like an array

  1. #1
    Join Date
    Jan 2003
    Location
    South Burlington, VT
    Posts
    3

    Looping thru results like an array

    Running Classic ASPdb.

    I execute ASPdb and get 900+ records returned. I want to export each record to a session variable and loop thru each item so they are displayed all at once (with no further user interaction)

    Does the data get stored in an array I can loop thru?

    Quick example:

    <%
    Set MyDb = Server.CreateObject("Asp.DB")
    MyDb.dbDSN = "DSN=database"
    MyDb.dbDBType="SQL"
    MyDb.dbUnit = 1
    MyDb.dbSQL = "Select * from SRS_AGENCY_REGIONS_VIEW"
    MyDb.dbDisplay = "false"
    MyDb.dbExportFlds = "0,1,2,3,4,5,6,7,11,13,14"
    Mydb.ASPdb

    ' here is where I want to loop thru the results and display them all at once
    %>
    Field1: <%=session("aspdb_1_REGION")%><br>
    Field2: <%=session("aspdb_1_ADDRESS")%><br><hr>


    Can I do something like:
    <% for x = 1 to MyDb.dbRecordCount %>
    Field1: <% =session("aspdb_1_REGION")[x] %><br>
    Field2: <% =session("aspdb_1_ADDRESS")[x] %><br><hr>
    <% next %>

    Output would look like this:
    Field1: USA
    Field2: 123 Anywhere street
    -------------------------
    Field1: Canada
    Field2: 123 Canadian Lane
    -------------------------

    etc etc


    --- Ashley

  2. #2
    Join Date
    Oct 2002
    Posts
    933
    I thin you meant you got the 900 records and you want to display them in your own way and thatis why you want to ? Can you use the user template to do that?

    Frank

  3. #3
    Join Date
    Jan 2003
    Location
    South Burlington, VT
    Posts
    3
    Quote Originally Posted by Frank
    I thin you meant you got the 900 records and you want to display them in your own way and thatis why you want to ? Can you use the user template to do that?

    Frank
    Yes, I want to display them in a custom layout. Where do I find more about the user template for ASPdb Pro?

  4. #4
    Join Date
    Oct 2002
    Posts
    933
    download all the classic examples and look at the user templates exaple. UPgrade to DotNet and yo ucan get more updated support.


    Frank

  5. #5
    Join Date
    Oct 2002
    Posts
    933
    Th etemplate features is not in the classic pro version. In ASP-db.Net versions, this is done like a repeater. Check the repeater samples and hope you can catch up with the DotNet versions.

    Frank

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •