473,473 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

looping question

ok.. here is my script

<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" &
Server.MapPath("/singlestour/fpdb/singles_tour.mdb")

SET oRS= Server.CreateObject("ADODB.Recordset")

strSQL = "Select username, total_score from current order by total_score
desc"

SET oRS= Conn.Execute(strSQL)

Const MAX_COLS = 2
Dim iCol, username, total_score

Response.Write "<table border='1'>"
Do While not oRS.Eof
iCol = 0
Response.Write "<tr>"
Do While iCol < MAX_COLS
If oRS.Eof Then
username = "&nbsp;"
total_score = "&nbsp;"
Else
username = oRS("username").value
total_score = oRS("total_score").value
oRS.moveNext
End If

Response.Write "<td>" & username & "</td>"
Response.Write "<td>" & total_score & "</td>"
Response.Write "<td>""against""</td>"
iCol = iCol + 1
Loop
Response.Write "</tr>"
Loop
Response.Write "</table>"
%>

and the display looks like this
http://www.gig-golf.com/singlestour/scores.asp but i want it to look like
this http://www.gig-golf.com/singlestour/scoresexample.asp

i am trying how to learn how to put html into asp.. but the main thing i
want to get rid of, is having the extra column on the right that says
against... i just want it in the middle.... any ideas??
Thanks
Jeff


Jul 19 '05 #1
4 1307
If iCol = 0 Then
Response.Write "<td>""against""</td>"
End If

Take the quotes off ""against"":
Response.Write "<td>against</td>"

Also, you could change your outer Do to "Do Until oRS.EOF". This is more
efficient as it's not having to perform negation on the condition.

Alan

"Jeff" <gi****************@verizon.net> wrote in message
news:ul**************@TK2MSFTNGP11.phx.gbl...
ok.. here is my script

<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" &
Server.MapPath("/singlestour/fpdb/singles_tour.mdb")

SET oRS= Server.CreateObject("ADODB.Recordset")

strSQL = "Select username, total_score from current order by total_score
desc"

SET oRS= Conn.Execute(strSQL)

Const MAX_COLS = 2
Dim iCol, username, total_score

Response.Write "<table border='1'>"
Do While not oRS.Eof
iCol = 0
Response.Write "<tr>"
Do While iCol < MAX_COLS
If oRS.Eof Then
username = "&nbsp;"
total_score = "&nbsp;"
Else
username = oRS("username").value
total_score = oRS("total_score").value
oRS.moveNext
End If

Response.Write "<td>" & username & "</td>"
Response.Write "<td>" & total_score & "</td>"
Response.Write "<td>""against""</td>"
iCol = iCol + 1
Loop
Response.Write "</tr>"
Loop
Response.Write "</table>"
%>

and the display looks like this
http://www.gig-golf.com/singlestour/scores.asp but i want it to look like
this http://www.gig-golf.com/singlestour/scoresexample.asp

i am trying how to learn how to put html into asp.. but the main thing i
want to get rid of, is having the extra column on the right that says
against... i just want it in the middle.... any ideas??
Thanks
Jeff

Jul 19 '05 #2
Ok. I got that part. But what about only having "against" in between the
first set of records, and not the second. like i have in the second example?
jeff

"J. Alan Rueckgauer" <vo**@dev.nul> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
If iCol = 0 Then
Response.Write "<td>""against""</td>"
End If

Take the quotes off ""against"":
Response.Write "<td>against</td>"

Also, you could change your outer Do to "Do Until oRS.EOF". This is more
efficient as it's not having to perform negation on the condition.

Alan

"Jeff" <gi****************@verizon.net> wrote in message
news:ul**************@TK2MSFTNGP11.phx.gbl...
ok.. here is my script

<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" &
Server.MapPath("/singlestour/fpdb/singles_tour.mdb")

SET oRS= Server.CreateObject("ADODB.Recordset")

strSQL = "Select username, total_score from current order by total_score
desc"

SET oRS= Conn.Execute(strSQL)

Const MAX_COLS = 2
Dim iCol, username, total_score

Response.Write "<table border='1'>"
Do While not oRS.Eof
iCol = 0
Response.Write "<tr>"
Do While iCol < MAX_COLS
If oRS.Eof Then
username = "&nbsp;"
total_score = "&nbsp;"
Else
username = oRS("username").value
total_score = oRS("total_score").value
oRS.moveNext
End If

Response.Write "<td>" & username & "</td>"
Response.Write "<td>" & total_score & "</td>"
Response.Write "<td>""against""</td>"
iCol = iCol + 1
Loop
Response.Write "</tr>"
Loop
Response.Write "</table>"
%>

and the display looks like this
http://www.gig-golf.com/singlestour/scores.asp but i want it to look like this http://www.gig-golf.com/singlestour/scoresexample.asp

i am trying how to learn how to put html into asp.. but the main thing i
want to get rid of, is having the extra column on the right that says
against... i just want it in the middle.... any ideas??
Thanks
Jeff


Jul 19 '05 #3
Did you try what I suggested?

By wrapping "<td>against</td>" in the "If iCol = 0" test, that means it will
only be written when iCol = 0. Presumably iCol is your counter to determine
if you're ready to start a new row, and if iCol = 0 then you've just output
the "left" columns..

If you haven't also realized, you should have an ElseIf iCol = 1 clause to
just write "<td>&nbsp;<td>" if you've just output the "against" details and
before starting a new row. This keeps the HTML consistent.

"Jeff" <gi****************@verizon.net> wrote in message
news:Oa**************@TK2MSFTNGP11.phx.gbl...
Ok. I got that part. But what about only having "against" in between the
first set of records, and not the second. like i have in the second example? jeff

"J. Alan Rueckgauer" <vo**@dev.nul> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
If iCol = 0 Then
Response.Write "<td>""against""</td>"
End If

Take the quotes off ""against"":
Response.Write "<td>against</td>"

Also, you could change your outer Do to "Do Until oRS.EOF". This is more
efficient as it's not having to perform negation on the condition.

Alan

"Jeff" <gi****************@verizon.net> wrote in message
news:ul**************@TK2MSFTNGP11.phx.gbl...
ok.. here is my script

<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" &
Server.MapPath("/singlestour/fpdb/singles_tour.mdb")

SET oRS= Server.CreateObject("ADODB.Recordset")

strSQL = "Select username, total_score from current order by total_score desc"

SET oRS= Conn.Execute(strSQL)

Const MAX_COLS = 2
Dim iCol, username, total_score

Response.Write "<table border='1'>"
Do While not oRS.Eof
iCol = 0
Response.Write "<tr>"
Do While iCol < MAX_COLS
If oRS.Eof Then
username = "&nbsp;"
total_score = "&nbsp;"
Else
username = oRS("username").value
total_score = oRS("total_score").value
oRS.moveNext
End If

Response.Write "<td>" & username & "</td>"
Response.Write "<td>" & total_score & "</td>"
Response.Write "<td>""against""</td>"
iCol = iCol + 1
Loop
Response.Write "</tr>"
Loop
Response.Write "</table>"
%>

and the display looks like this
http://www.gig-golf.com/singlestour/scores.asp but i want it to look

like this http://www.gig-golf.com/singlestour/scoresexample.asp

i am trying how to learn how to put html into asp.. but the main thing i want to get rid of, is having the extra column on the right that says
against... i just want it in the middle.... any ideas??
Thanks
Jeff



Jul 19 '05 #4
sorry.. i did see that... and forgot to put that in there.. thanks a bunch
bud :)
Jeff
"J. Alan Rueckgauer" <vo**@dev.nul> wrote in message
news:uA*************@TK2MSFTNGP12.phx.gbl...
Did you try what I suggested?

By wrapping "<td>against</td>" in the "If iCol = 0" test, that means it will only be written when iCol = 0. Presumably iCol is your counter to determine if you're ready to start a new row, and if iCol = 0 then you've just output the "left" columns..

If you haven't also realized, you should have an ElseIf iCol = 1 clause to
just write "<td>&nbsp;<td>" if you've just output the "against" details and before starting a new row. This keeps the HTML consistent.

"Jeff" <gi****************@verizon.net> wrote in message
news:Oa**************@TK2MSFTNGP11.phx.gbl...
Ok. I got that part. But what about only having "against" in between the
first set of records, and not the second. like i have in the second example?
jeff

"J. Alan Rueckgauer" <vo**@dev.nul> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
If iCol = 0 Then
Response.Write "<td>""against""</td>"
End If

Take the quotes off ""against"":
Response.Write "<td>against</td>"

Also, you could change your outer Do to "Do Until oRS.EOF". This is more efficient as it's not having to perform negation on the condition.

Alan

"Jeff" <gi****************@verizon.net> wrote in message
news:ul**************@TK2MSFTNGP11.phx.gbl...
> ok.. here is my script
>
> <%
> Set Conn = Server.CreateObject("ADODB.Connection")
> Conn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" &
> Server.MapPath("/singlestour/fpdb/singles_tour.mdb")
>
> SET oRS= Server.CreateObject("ADODB.Recordset")
>
> strSQL = "Select username, total_score from current order by total_score > desc"
>
> SET oRS= Conn.Execute(strSQL)
>
> Const MAX_COLS = 2
> Dim iCol, username, total_score
>
> Response.Write "<table border='1'>"
> Do While not oRS.Eof
> iCol = 0
> Response.Write "<tr>"
> Do While iCol < MAX_COLS
> If oRS.Eof Then
> username = "&nbsp;"
> total_score = "&nbsp;"
> Else
> username = oRS("username").value
> total_score = oRS("total_score").value
> oRS.moveNext
> End If
>
> Response.Write "<td>" & username & "</td>"
> Response.Write "<td>" & total_score & "</td>"
> Response.Write "<td>""against""</td>"
> iCol = iCol + 1
> Loop
> Response.Write "</tr>"
> Loop
> Response.Write "</table>"
> %>
>
> and the display looks like this
> http://www.gig-golf.com/singlestour/scores.asp but i want it to look
like
> this http://www.gig-golf.com/singlestour/scoresexample.asp
>
> i am trying how to learn how to put html into asp.. but the main
thing i > want to get rid of, is having the extra column on the right that

says > against... i just want it in the middle.... any ideas??
> Thanks
> Jeff
>
>
>
>



Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Colin Steadman | last post by:
I've create a simple survey using ASP. Its finished and works, but one aspect of my coding is annoying me and I cant figure out a better way of doing it. Basically the questions are stored in...
0
by: | last post by:
Greets All, Question on data in datagrid /listbox and looping? I’m trying to decide the best way to write this code. 1 would like the user to make several selections from one listbox/combo box...
0
by: | last post by:
Greets All, Question on data in datagrid /listbox and looping? I’m trying to decide the best way to write this code. 1 would like the user to make several selections from one listbox/combo box...
13
by: JayCallas | last post by:
I know this question has been asked. And the usual answer is don't use cursors or any other looping method. Instead, try to find a solution that uses set-based queries. But this brings up...
2
by: clinttoris | last post by:
Hello, If someone could help me it would be appreciated as I am not having much luck. I'm struggling with my asp code and have some questions relating to asp and oracle database. First...
6
by: Luke - eat.lemons | last post by:
Hi, Im pretty new to asp so all light on this question would be great. Basically i need to test to see what value is set (where to retrieve the data from) so ive done it like this: If...
3
by: Luke - eat.lemons | last post by:
Sorry for the post in this NG but im short on time to get this working and i haven't seem to of got a response anywhere else. Im pretty new to asp so all light on this question would be great. ...
2
by: Davaa | last post by:
Dear all, I am a student making a MS Form application in C++. I would ask a question about "Timer". Sample code which I am developing is below. private: System::Void...
3
by: chiku1523 | last post by:
Hi, Please find the following code. In function setAnswers, I am looping with each question. I have inner loop, which is looping for each answers of the questions. If any of the answer for question...
1
by: Robocop | last post by:
Having just started using C again after some years off, i've been stumped by a problem i think someone more experienced could probably solve pretty easily. I have these 4 objects (vectors), and i...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.