Results 1 to 12 of 12

Thread: Very new at ASP.....can you help??

  1. #1

    Thread Starter
    Hyperactive Member barrk's Avatar
    Join Date
    Sep 2000
    Location
    My own little world
    Posts
    274
    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????

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    shouldnt the for loop be

    for n = 0 to ubound(secname) - 1
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3

    Thread Starter
    Hyperactive Member barrk's Avatar
    Join Date
    Sep 2000
    Location
    My own little world
    Posts
    274
    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!

  4. #4

    Thread Starter
    Hyperactive Member barrk's Avatar
    Join Date
    Sep 2000
    Location
    My own little world
    Posts
    274
    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!

  5. #5
    Addicted Member
    Join Date
    Sep 2000
    Posts
    219
    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.

  6. #6

    Thread Starter
    Hyperactive Member barrk's Avatar
    Join Date
    Sep 2000
    Location
    My own little world
    Posts
    274
    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?

  7. #7
    Addicted Member
    Join Date
    Sep 2000
    Posts
    219
    No I don't think so. Will it?

  8. #8

    Thread Starter
    Hyperactive Member barrk's Avatar
    Join Date
    Sep 2000
    Location
    My own little world
    Posts
    274

    Unhappy

    I don't know!!!!!!!!

  9. #9
    Addicted Member
    Join Date
    Sep 2000
    Posts
    219
    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.

  10. #10

    Thread Starter
    Hyperactive Member barrk's Avatar
    Join Date
    Sep 2000
    Location
    My own little world
    Posts
    274
    Sure!!!!! I'll let you know tomorrow though.....It's about time to go home now.

    Thanks for your help.

  11. #11
    Addicted Member Active's Avatar
    Join Date
    Jan 2001
    Location
    Lat: 13° 4' 46" N, Long: 80° 15' 20" E
    Posts
    209
    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
    If you can't beat your computer at chess, try kickboxing !!!
    [Download Tag Editing Tools.]

  12. #12

    Thread Starter
    Hyperactive Member barrk's Avatar
    Join Date
    Sep 2000
    Location
    My own little world
    Posts
    274
    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
  •  



Click Here to Expand Forum to Full Width