Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    May 2005
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Select Option With Asp

    Hi,

    I was trying new ways to show the data from database and I was thinking in use the SELECT OPTION statement of html for doing this task.

    For example,

    How I shown the results from a database in this way?

    <P>Page results:
    <SELECT NAME=sections MULTIPLE>
    <OPTION><%response.write (rs("english"))%></OPTION>
    <OPTION><%response.write (rs("castilian"))%></OPTION>
    </SELECT>
    </P>


    It is will shown one record by time, Can I output more than 1 record at time?

    Or I must use Jscript?


    Thank you for any assistance.

    JanLee

  • #2
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,174
    Thanks
    19
    Thanked 66 Times in 65 Posts
    What is your data structure? What output do you want from the db?

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,043
    Thanks
    0
    Thanked 251 Times in 247 Posts
    Code:
    <SELECT NAME=sections MULTIPLE>
    <%
      while not rs.BOF and not rs.EOF
    %>
    <OPTION><%=rs("english")%></OPTION>
    <OPTION><%=rs("castilian")%></OPTION>
    <%
        rs.movenext
      wend
    %>  
    </SELECT>

  • #4
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,174
    Thanks
    19
    Thanked 66 Times in 65 Posts
    Quote Originally Posted by glenngv
    Code:
    <SELECT NAME=sections MULTIPLE>
    <%
      while not rs.BOF and not rs.EOF
    %>
    <OPTION><%=rs("english")%></OPTION>
    <OPTION><%=rs("castilian")%></OPTION>
    <%
        rs.movenext
      wend
    %>  
    </SELECT>
    This will show rs("english") and rs("castilian") on alternating lines for each record in the db, is this what you want? eg. your list will look like

    Code:
    record1.english
    record1.castilian
    record2.english
    record2.castilian
    record3.english
    record3.castilian

  • #5
    Regular Coder
    Join Date
    May 2005
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Output the records!

    I testes the script of glenngv. It is works, but I believe there is not any way to shown the records in one select option only! Right? it repeat the select option for each record! It is not pretty!

    Thank for your assistance.

    JL

  • #6
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,174
    Thanks
    19
    Thanked 66 Times in 65 Posts
    do you want it to output as

    record1.english record1.castilian
    record2.english record2.castilian
    etc
    Code:
    <SELECT NAME=sections MULTIPLE>
    <%
      while not rs.BOF and not rs.EOF
    %>
    <OPTION><%=rs("english")%><%=rs("castilian")%></OPTION>
    <%
        rs.movenext
      wend
    %>  
    </SELECT>
    or do you want

    record1.english
    record1.castilian

    with each record in its own select box?

    Code:
    <%
      while not rs.BOF and not rs.EOF
    %>
    <SELECT NAME=sections MULTIPLE>
    <OPTION><%=rs("english")%></OPTION>
    <OPTION><%=rs("castilian")%></OPTION>
    </SELECT>
    <%
        rs.movenext
      wend
    %>

  • #7
    Regular Coder
    Join Date
    May 2005
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you friends!

    JanLee


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •