If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > How to populate a list box/menu using ASP ??

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-20-04, 02:34
Mini Nair Mini Nair is offline
Registered User
 
Join Date: Feb 2004
Posts: 12
How to populate a list box/menu using ASP ??

I have a list box/menu in my form, the values of which come from the database..i have retrieved those values but now i am not finding a way to put these values into the list/menu...using ASP ??? Can anyone please help me out ........
Reply With Quote
  #2 (permalink)  
Old 03-20-04, 03:02
kenyanboy kenyanboy is offline
Registered User
 
Join Date: Mar 2004
Location: Nairobi
Posts: 6
Re: How to populate a list box/menu using ASP ??

I assume that when you say you have retrieved the records from the database they are stored in a RecordSet.

If this is the case then you need to loop through the recordset while writing each record to your ASP file within the select tag of your list/menu box.

e.g. (assuming the name of your recordset is "rs" and you have a field by the name "FieldName")

<SELECT>
<%
Do While Not rs.BOF
%>
<OPTION><%=rs("FieldName")%><OPTION>
<%
'remember to move to the next record
rs.MoveNext
Loop
%>
</SELECT>
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On