Separating results

Discussion in 'ASP General' started by MRK, Jul 1, 2004.

  1. MRK

    MRK Guest

    I want to add a <p> after 10 results are given
    and do this in a loop after every 10 results.
    Here is my query and my current results code

    How would I modify this to add a <P> after
    every 10 results for ts?



    <%
    Response.Buffer = True
    Dim connStrx, rs, ss, ts, book1, verse1, chap1, bookopt
    connStrx = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &
    Server.MapPath("\data\kwm\kjv.mdb")
    Set rs = CreateObject("ADODB.Recordset")
    Set ss = CreateObject("ADODB.Recordset")
    Set ts = CreateObject("ADODB.Recordset")

    rs.Open "select distinct booktitle, book from bibletable order by book ASC",
    connStrx, 3, 4
    If Not rs.EOF Then
    If Request.Form("Submit")="GO" Then
    bookopt = request.form("book")
    else
    bookopt=""
    end if
    While Not rs.EOF
    If trim(bookopt) = trim(rs("booktitle")) then
    response.write "<option value='" & rs("booktitle") & "' selected>" &
    rs("booktitle") & "</option>"
    else
    response.write "<option value='" & rs("booktitle") & "'>" &
    rs("booktitle") & "</option>"
    end if
    rs.MoveNext
    Wend

    ELSE
    END IF
    rs.close
    set rs = nothing

    If len(bookopt)>1 Then
    ss.Open "select distinct chapter from bibletable where
    [bibletable.booktitle]='" & bookopt & "' order by chapter ASC", connStrx, 3,
    4
    If Not ss.EOF Then
    While Not ss.EOF
    chap1=ss("chapter")
    response.write ss("chapter")

    ' here is where I want to create a <p> after every 10 results

    ts.Open "select * from bibletable where [bibletable.booktitle]='" &
    bookopt & "' and [bibletable.chapter]=" & chap1 & " order by verse ASC",
    connStrx, 3, 4
    If Not ts.EOF Then
    While Not ts.EOF
    response.write " <font color=red>" & ts("verse") & "</font> " &
    ts("textdata") & " "
    ts.MoveNext
    Wend
    ts.close
    else
    end if
    ss.MoveNext
    Wend
    else
    end if
    end if
    %>
     
    MRK, Jul 1, 2004
    #1
    1. Advertising

  2. MRK

    Ray at Guest

    The simple way is to put in a counter like so (added code in uppercase):



    DIM I
    I = 1
    RESPONSE.WRITE "<p>"
    While Not ss.EOF
    chap1=ss("chapter")
    response.write ss("chapter")

    ' here is where I want to create a <p> after every 10 results
    IF I = 10 THEN
    RESPONSE.WRITE "</p>" & vbCrLf & "<p>"
    I = 0
    END IF

    ts.Open "select * from bibletable where [bibletable.booktitle]='" &
    bookopt & "' and [bibletable.chapter]=" & chap1 & " order by verse ASC",
    connStrx, 3, 4
    If Not ts.EOF Then
    While Not ts.EOF
    response.write " <font color=red>" & ts("verse") & "</font> " &
    ts("textdata") & " "
    ts.MoveNext
    Wend
    ts.close
    else
    end if
    ss.MoveNext

    I = I + 1

    Wend


    Ray at work

    "MRK" <sdkngfksdnf> wrote in message
    news:...
    >I want to add a <p> after 10 results are given
    > and do this in a loop after every 10 results.
    > Here is my query and my current results code
    >
    > How would I modify this to add a <P> after
    > every 10 results for ts?
    >
    >
     
    Ray at, Jul 1, 2004
    #2
    1. Advertising

  3. MRK

    MRK Guest

    DOH !!!
    so simple. thanks
    I should apply my VFP experience more in ASP
    I do simple loops like this all the time in VFP



    "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    news:...
    > outside the loop put in a variable (XX = 0)
    > At that point in the loop you want the <P> do a:
    > IF XX >= 10 then
    > ..."<P>"....
    > XX = 0
    > ELSE
    > XX = XX + 1
    > END IF
    >
    >
    > --
    > Curt Christianson
    > Owner/Lead Developer, DF-Software
    > Site: http://www.Darkfalz.com
    > Blog: http://blog.Darkfalz.com
    >
    >
    > "MRK" <sdkngfksdnf> wrote in message
    > news:...
    > > I want to add a <p> after 10 results are given
    > > and do this in a loop after every 10 results.
    > > Here is my query and my current results code
    > >
    > > How would I modify this to add a <P> after
    > > every 10 results for ts?
    > >
    > >
    > >
    > > <%
    > > Response.Buffer = True
    > > Dim connStrx, rs, ss, ts, book1, verse1, chap1, bookopt
    > > connStrx = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &
    > > Server.MapPath("\data\kwm\kjv.mdb")
    > > Set rs = CreateObject("ADODB.Recordset")
    > > Set ss = CreateObject("ADODB.Recordset")
    > > Set ts = CreateObject("ADODB.Recordset")
    > >
    > > rs.Open "select distinct booktitle, book from bibletable order by book

    > ASC",
    > > connStrx, 3, 4
    > > If Not rs.EOF Then
    > > If Request.Form("Submit")="GO" Then
    > > bookopt = request.form("book")
    > > else
    > > bookopt=""
    > > end if
    > > While Not rs.EOF
    > > If trim(bookopt) = trim(rs("booktitle")) then
    > > response.write "<option value='" & rs("booktitle") & "' selected>"

    &
    > > rs("booktitle") & "</option>"
    > > else
    > > response.write "<option value='" & rs("booktitle") & "'>" &
    > > rs("booktitle") & "</option>"
    > > end if
    > > rs.MoveNext
    > > Wend
    > >
    > > ELSE
    > > END IF
    > > rs.close
    > > set rs = nothing
    > >
    > > If len(bookopt)>1 Then
    > > ss.Open "select distinct chapter from bibletable where
    > > [bibletable.booktitle]='" & bookopt & "' order by chapter ASC",

    connStrx,
    > 3,
    > > 4
    > > If Not ss.EOF Then
    > > While Not ss.EOF
    > > chap1=ss("chapter")
    > > response.write ss("chapter")
    > >
    > > ' here is where I want to create a <p> after every 10 results
    > >
    > > ts.Open "select * from bibletable where [bibletable.booktitle]='" &
    > > bookopt & "' and [bibletable.chapter]=" & chap1 & " order by verse ASC",
    > > connStrx, 3, 4
    > > If Not ts.EOF Then
    > > While Not ts.EOF
    > > response.write " <font color=red>" & ts("verse") & "</font> " &
    > > ts("textdata") & " "
    > > ts.MoveNext
    > > Wend
    > > ts.close
    > > else
    > > end if
    > > ss.MoveNext
    > > Wend
    > > else
    > > end if
    > > end if
    > > %>
    > >
    > >

    >
    >
     
    MRK, Jul 1, 2004
    #3
  4. MRK

    MRK Guest

    Thanks Ray.
    as I told Curt. I do simple loops like
    this in VFP and did not think I could do
    it in ASP..

    I did have to rearrange the loop though
    as I wanted the <p> within the ts results
    10 was also to high and had use 7

    Thanks again for the assist

    <%
    If Not ts.EOF Then
    TX=1
    While Not ts.EOF
    IF TX = 7 THEN
    RESPONSE.WRITE "</p>" & vbCrLf & "<p>"
    TX = 0
    END IF
    response.write " <font color=red>" & ts("verse") & "</font> " &
    ts("textdata") & " "
    ts.MoveNext
    TX = TX + 1
    Wend
    ts.close
    else
    end if
    %>


    "Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
    message news:%...
    > The simple way is to put in a counter like so (added code in uppercase):
    >
    >
    >
    > DIM I
    > I = 1
    > RESPONSE.WRITE "<p>"
    > While Not ss.EOF
    > chap1=ss("chapter")
    > response.write ss("chapter")
    >
    > ' here is where I want to create a <p> after every 10 results
    > IF I = 10 THEN
    > RESPONSE.WRITE "</p>" & vbCrLf & "<p>"
    > I = 0
    > END IF
    >
    > ts.Open "select * from bibletable where [bibletable.booktitle]='" &
    > bookopt & "' and [bibletable.chapter]=" & chap1 & " order by verse ASC",
    > connStrx, 3, 4
    > If Not ts.EOF Then
    > While Not ts.EOF
    > response.write " <font color=red>" & ts("verse") & "</font> " &
    > ts("textdata") & " "
    > ts.MoveNext
    > Wend
    > ts.close
    > else
    > end if
    > ss.MoveNext
    >
    > I = I + 1
    >
    > Wend
    >
    >
    > Ray at work
    >
    > "MRK" <sdkngfksdnf> wrote in message
    > news:...
    > >I want to add a <p> after 10 results are given
    > > and do this in a loop after every 10 results.
    > > Here is my query and my current results code
    > >
    > > How would I modify this to add a <P> after
    > > every 10 results for ts?
    > >
    > >

    >
     
    MRK, Jul 1, 2004
    #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. crazyrdx
    Replies:
    4
    Views:
    837
    Mike Treseler
    Jan 23, 2006
  2. Chad Z. Hower aka Kudzu

    Separating code from design

    Chad Z. Hower aka Kudzu, Jan 23, 2004, in forum: ASP .Net
    Replies:
    6
    Views:
    448
    Chad Z. Hower aka Kudzu
    Jan 24, 2004
  3. mca
    Replies:
    3
    Views:
    397
    ccallen
    May 6, 2004
  4. Earl Teigrob
    Replies:
    3
    Views:
    607
    John Saunders
    Jun 10, 2004
  5. Chumley the Walrus

    Separating form elements on aspx page

    Chumley the Walrus, Aug 3, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    397
    Eliyahu Goldin
    Aug 3, 2004
Loading...

Share This Page