|
-
Mar 8th, 2001, 04:43 PM
#1
Thread Starter
Hyperactive Member
Inside server side tags <%
I have a recordset built using adodb on an asp page.
I put all sectionnames into an array sectname()
%>
This works great....now's the part I can't get.
I need to loop through the values in sectname and place each one in a
cell
on a table.
This is what I tried
I set up my table then put
for n = 0 to ubound(secname()-1)
<td width="50%"><%sectname(n)%>
next
It doesn't work........what do I need to do????
-
Mar 8th, 2001, 04:48 PM
#2
shouldnt the for loop be
for n = 0 to ubound(secname) - 1
-
Mar 8th, 2001, 04:54 PM
#3
Thread Starter
Hyperactive Member
You're probably right........I changed that but it didn't fix it. I put the for/next etc into <% %> tags too.
<%
for n = 0 to ubound(sectname) - 1
response.write "<td width=""50%""><%=sectname(n)%></td>"
next
%>
Can you offer another suggestion??
Thanks!
-
Mar 8th, 2001, 05:35 PM
#4
Thread Starter
Hyperactive Member
Okay...I got it!!!! Here's what I did in case you're interested...
<%
for n = 0 to ubound(sectname) - 1
response.write "<tr>"
response.write "<td width=""50%"">" & sectname(n)
response.write "</td>"
next
%>
Thanks for the help!
-
Mar 8th, 2001, 05:45 PM
#5
Addicted Member
hello barrk,
suppose the ado recordset is rst
try this:
Code:
<table>
<%
'suppose your recordset is rst
If rst.eof = false and rst.bof = false then 'if the recordset is empty then
'do something here... maybe redirect your response to another page.
Else
Do
%>
<tr>
<td>
<%
Response.Write rst("myfield1") 'writes the value of myfield1 in the first column
%>
</td>
<td>
<%
Response.Write rst("myfield2") 'writes the value of myfield2 in the second column
%>
</td>
</tr>
<%
rst.movenext
Loop until rst.eof = true
%>
</table>
Last edited by Shafee; Mar 8th, 2001 at 05:50 PM.
-
Mar 8th, 2001, 05:57 PM
#6
Thread Starter
Hyperactive Member
Okay....I know this is going to sound extremely stupid but bear in mind I'm learning please........
Do you have to take a "trip" to the server each time the <% is encountered??? Does this slow it down?
-
Mar 8th, 2001, 06:02 PM
#7
Addicted Member
No I don't think so. Will it?
-
Mar 8th, 2001, 06:07 PM
#8
Thread Starter
Hyperactive Member
-
Mar 8th, 2001, 06:24 PM
#9
Addicted Member
You could do a test you know...
code1
Code:
<%
For i = 1 to 100000000000
Response.Write "<br>" & i
next i
%>
code2
Code:
<%
For i = 1 to 100000000000
%>
<br>
<%
Response.Write i
%>
I prefer code 2 because it is easier to design the page with frontpage and convert it directly to asp. Not because of speed. I didn't know that there is a speed difference.
Can you test it for me please?
Last edited by Shafee; Mar 8th, 2001 at 06:44 PM.
-
Mar 8th, 2001, 06:42 PM
#10
Thread Starter
Hyperactive Member
Sure!!!!! I'll let you know tomorrow though.....It's about time to go home now.
Thanks for your help.
-
Mar 8th, 2001, 10:52 PM
#11
Addicted Member
Hi katie,
put
Response.buffer = True
at the very top of the page.
This will buffer the output instead of sending data for
each loop.
At any point, if you need to send out data to client before
continuing processing. use.
Response.Flush
-
Mar 9th, 2001, 10:24 AM
#12
Thread Starter
Hyperactive Member
Thanks Active!!!!!!!! I appreciate the help!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|