ASP Recordset Question

Discussion in 'NZ Computing' started by Simon, Feb 24, 2004.

  1. Simon

    Simon Guest

    I have created an ASP page which is designed to display links from a
    database. The database table contains 3 columns:
    - Category
    - Title
    - URL

    The links are to be arranged under category headings, so I logically
    thought that I could have a While Loop to create the headings, and while
    the category remains the same display the link titles and urls
    underneath the heading, which requires another (nested) While Loop.

    However, ASP does not like this and as much as I try I cannot get the
    recordset looping inside a recordset.

    Please reply if you have any suggestions, as they are much appreciated.

    Simon
     
    Simon, Feb 24, 2004
    #1
    1. Advertising

  2. Simon wrote:
    > I have created an ASP page which is designed to display links from a
    > database. The database table contains 3 columns:
    > - Category
    > - Title
    > - URL
    >
    > The links are to be arranged under category headings, so I logically
    > thought that I could have a While Loop to create the headings, and while
    > the category remains the same display the link titles and urls
    > underneath the heading, which requires another (nested) While Loop.
    >
    > However, ASP does not like this and as much as I try I cannot get the
    > recordset looping inside a recordset.
    >
    > Please reply if you have any suggestions, as they are much appreciated.
    >
    > Simon
    >



    try opening two connections to the database with a recordset for each.
     
    Robert Bradshaw, Feb 24, 2004
    #2
    1. Advertising

  3. Simon

    Alan Howard Guest

    Assumes your RecordSet is sorted on category. Untested, but you should get
    the idea.

    OldCategory = ""
    Category = ""
    Title = ""
    Value= ""

    Do While Not oTitles.EOF
    Category = oTitles.Fields("Category").Value
    Title = oTitles.Fields("Title").Value
    Value = oTitles.Fields("URL").Value
    If (Category <> OldCategory) Then
    ' New category. Output the category name and do any other
    formatting.
    Response.Write ...
    ' Assign the new category to the OldCategory variable.
    OldCategory = Category
    End If
    ' Output the title and URL values.
    Response.Write ...
    oTitles.MoveNext
    Loop

    ' Close and kill ...

    Regards,

    Alan

    "Simon" <simonatsimonbankdot@com> wrote in message
    news:403bdb38$0$22510$...
    > I have created an ASP page which is designed to display links from a
    > database. The database table contains 3 columns:
    > - Category
    > - Title
    > - URL
    >
    > The links are to be arranged under category headings, so I logically
    > thought that I could have a While Loop to create the headings, and while
    > the category remains the same display the link titles and urls
    > underneath the heading, which requires another (nested) While Loop.
    >
    > However, ASP does not like this and as much as I try I cannot get the
    > recordset looping inside a recordset.
    >
    > Please reply if you have any suggestions, as they are much appreciated.
    >
    > Simon
    >
     
    Alan Howard, Feb 25, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?a2JyYWQ=?=

    ASP Problem Updating Recordset

    =?Utf-8?B?a2JyYWQ=?=, Apr 3, 2004, in forum: Microsoft Certification
    Replies:
    3
    Views:
    3,231
    DalePres
    Apr 10, 2004
  2. =?Utf-8?B?c2FuanU=?=

    information about asp ,oracle,asp.net certification?

    =?Utf-8?B?c2FuanU=?=, May 18, 2005, in forum: Microsoft Certification
    Replies:
    1
    Views:
    710
    Bob Christian
    May 18, 2005
  3. Zabron Muyambo

    Easy Moving from ASP to ASP.NET???

    Zabron Muyambo, Oct 26, 2004, in forum: MCSD
    Replies:
    7
    Views:
    550
    Zabron Muyambo
    Oct 27, 2004
  4. thehobbit
    Replies:
    0
    Views:
    3,945
    thehobbit
    Nov 22, 2006
  5. imman

    session from asp to asp.net

    imman, Feb 20, 2008, in forum: General Computer Support
    Replies:
    0
    Views:
    957
    imman
    Feb 20, 2008
Loading...

Share This Page