Qry data to Page

Discussion in 'ASP General' started by BaWork, Nov 20, 2006.

  1. BaWork

    BaWork Guest

    I have the following data pulled from a db query - it is calculating the
    total number of listings for a given category.

    CountOfmain_cat_id main_cat_id main_cat
    7 1 Clubs
    1 2 Accessories
    3 3 Apparel
    6 4 Instruction
    1 5 Course Equipment
    2 8 Real Estate
    1 9 Employment
    1 10 General

    I need to display that information on a page, but not it table. I have
    an example mocked-up.

    http://brettatkin.com/example.gif

    Next to each Cat listing, I put the number of ads for that category (5 Ads).

    How do I make this happen, take the data from the rs and put it next to
    each Category heading?

    I need to assign the value of CountOfmain_cat_id to a variable for each
    row so that I can reference that variable in the HTML next to each cat
    heading.

    I'm stuck... Any ideas?

    Thanks.

    Brett
     
    BaWork, Nov 20, 2006
    #1
    1. Advertising

  2. "BaWork" <> wrote in message
    news:...
    > I have the following data pulled from a db query - it is calculating the
    > total number of listings for a given category.
    >
    > CountOfmain_cat_id main_cat_id main_cat
    > 7 1 Clubs
    > 1 2 Accessories
    > 3 3 Apparel
    > 6 4 Instruction
    > 1 5 Course Equipment
    > 2 8 Real Estate
    > 1 9 Employment
    > 1 10 General
    >
    > I need to display that information on a page, but not it table. I have
    > an example mocked-up.
    >
    > http://brettatkin.com/example.gif
    >
    > Next to each Cat listing, I put the number of ads for that category (5

    Ads).
    >
    > How do I make this happen, take the data from the rs and put it next to
    > each Category heading?
    >
    > I need to assign the value of CountOfmain_cat_id to a variable for each
    > row so that I can reference that variable in the HTML next to each cat
    > heading.
    >
    > I'm stuck... Any ideas?
    >



    <table>
    <tr><td>
    <%
    Dim i : i = 0
    Do Until rs.EOF

    'Place code and markup to render contents here

    rs.MoveNext

    If Not rs.EOF Then
    If (i Mod 2) = 0 Then
    Response.Write "</td><td>"
    Else
    Response.Write "</td></tr><td>"
    End If
    End If
    i = i + 1
    Loop
    %>
    </td></tr>
    </table>



    > Thanks.
    >
    > Brett
     
    Anthony Jones, Nov 20, 2006
    #2
    1. Advertising

  3. BaWork

    BaWork Guest

    Thanks for the help.

    This is what I ended up with:

    <%
    Do Until rs_ad_count.EOF

    Select Case rs_ad_count.Fields.Item("main_cat_id").Value

    Case "1"
    clubs_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
    Case "2"
    accessories_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
    Case "3"
    apparel_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
    Case "4"
    instruction_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
    Case "5"
    equipment_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
    Case "6"
    travel_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
    Case "7"
    services_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
    Case "8"
    real_estate_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
    Case "9"
    employment_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
    Case "10"
    general_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
    End Select

    rs_ad_count.MoveNext
    Loop
    %>


    Anthony Jones wrote:
    > "BaWork" <> wrote in message
    > news:...
    >
    >>I have the following data pulled from a db query - it is calculating the
    >>total number of listings for a given category.
    >>
    >>CountOfmain_cat_id main_cat_id main_cat
    >>7 1 Clubs
    >>1 2 Accessories
    >>3 3 Apparel
    >>6 4 Instruction
    >>1 5 Course Equipment
    >>2 8 Real Estate
    >>1 9 Employment
    >>1 10 General
    >>
    >>I need to display that information on a page, but not it table. I have
    >>an example mocked-up.
    >>
    >>http://brettatkin.com/example.gif
    >>
    >>Next to each Cat listing, I put the number of ads for that category (5

    >
    > Ads).
    >
    >>How do I make this happen, take the data from the rs and put it next to
    >>each Category heading?
    >>
    >>I need to assign the value of CountOfmain_cat_id to a variable for each
    >>row so that I can reference that variable in the HTML next to each cat
    >>heading.
    >>
    >>I'm stuck... Any ideas?
    >>

    >
    >
    >
    > <table>
    > <tr><td>
    > <%
    > Dim i : i = 0
    > Do Until rs.EOF
    >
    > 'Place code and markup to render contents here
    >
    > rs.MoveNext
    >
    > If Not rs.EOF Then
    > If (i Mod 2) = 0 Then
    > Response.Write "</td><td>"
    > Else
    > Response.Write "</td></tr><td>"
    > End If
    > End If
    > i = i + 1
    > Loop
    > %>
    > </td></tr>
    > </table>
    >
    >
    >
    >>Thanks.
    >>
    >>Brett

    >
    >
    >
     
    BaWork, Nov 20, 2006
    #3
  4. "BaWork" <> wrote in message
    news:%...
    > Thanks for the help.
    >
    > This is what I ended up with:
    >
    > <%
    > Do Until rs_ad_count.EOF
    >
    > Select Case rs_ad_count.Fields.Item("main_cat_id").Value
    >
    > Case "1"
    > clubs_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
    > Case "2"
    > accessories_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
    > Case "3"
    > apparel_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
    > Case "4"
    > instruction_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
    > Case "5"
    > equipment_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
    > Case "6"
    > travel_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
    > Case "7"
    > services_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
    > Case "8"
    > real_estate_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
    > Case "9"
    > employment_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
    > Case "10"
    > general_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Value
    > End Select
    >
    > rs_ad_count.MoveNext
    > Loop
    > %>
    >


    Seems to me that what would be better would be to store the category
    description and gif file name in the database and include them in the query
    output. The page content is then driven by the DB. If you want to add a
    new category you upload a new gif for it and make a change the DB. There
    would be no need to modify this page to cope with a new category.
     
    Anthony Jones, Nov 20, 2006
    #4
    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. Bob Green via .NET 247

    qry returns nothing (no data matched qry)

    Bob Green via .NET 247, Apr 16, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    399
    Sebastian
    Apr 16, 2004
  2. Qry strlen ?

    , Oct 9, 2006, in forum: C Programming
    Replies:
    9
    Views:
    459
    Peter Nilsson
    Oct 10, 2006
  3. Sheth Raxit

    Qry : Behaviour of fgets -- ?

    Sheth Raxit, Sep 6, 2007, in forum: C Programming
    Replies:
    345
    Views:
    5,364
    Flash Gordon
    Oct 20, 2007
  4. CJM
    Replies:
    14
    Views:
    286
    Yan-Hong Huang[MSFT]
    Feb 26, 2004
  5. Replies:
    9
    Views:
    1,066
    MikeR
    Mar 22, 2010
Loading...

Share This Page