...

View Full Version : Select Option With Asp



JANLEE
09-02-2005, 02:09 PM
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

NancyJ
09-02-2005, 02:25 PM
What is your data structure? What output do you want from the db?

glenngv
09-02-2005, 02:25 PM
<SELECT NAME=sections MULTIPLE>
<%
while not rs.BOF and not rs.EOF
%>
<OPTION><%=rs("english")%></OPTION>
<OPTION><%=rs("castilian")%></OPTION>
<%
rs.movenext
wend
%>
</SELECT>

NancyJ
09-02-2005, 02:28 PM
<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



record1.english
record1.castilian
record2.english
record2.castilian
record3.english
record3.castilian

JANLEE
09-02-2005, 02:40 PM
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

NancyJ
09-02-2005, 02:45 PM
do you want it to output as

record1.english record1.castilian
record2.english record2.castilian
etc


<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?



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

JANLEE
09-03-2005, 01:09 AM
Thank you friends!

JanLee



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum