Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Separating results

Reply
Thread Tools

Separating results

 
 
MRK
Guest
Posts: n/a
 
      07-01-2004
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
%>


 
Reply With Quote
 
 
 
 
Ray at
Guest
Posts: n/a
 
      07-01-2004
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?
>
>


 
Reply With Quote
 
 
 
 
MRK
Guest
Posts: n/a
 
      07-01-2004
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
> > %>
> >
> >

>
>



 
Reply With Quote
 
MRK
Guest
Posts: n/a
 
      07-01-2004
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?
> >
> >

>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Separating control and data paths crazyrdx VHDL 4 01-23-2006 07:06 AM
Separating form elements on aspx page Chumley the Walrus ASP .Net 1 08-03-2004 05:21 PM
Design Issue: Separating Application Security Model from the Application (Custom or User) Controls Earl Teigrob ASP .Net 3 06-10-2004 01:56 AM
Question about separating logic from html? mca ASP .Net 3 05-06-2004 03:41 PM
Separating code from design Chad Z. Hower aka Kudzu ASP .Net 6 01-24-2004 04:51 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57