Print Page | Close Window

help with creating a dropdown box

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=3141
Printed Date: 29 March 2026 at 12:00pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: help with creating a dropdown box
Posted By: beginner
Subject: help with creating a dropdown box
Date Posted: 30 May 2003 at 8:32am

I've been trying to crete a dropdown box for a form but my code isn't quiet working.

Here is the code

<%Dim DataConn
  Dim SQL
  Dim MyRS
  Dim k

 Set DataConn=Server.CreateObject("ADODB.Connection")
 DataConn.Open Application("Connection2_ConnectionString")
 Set MyRS=Server.CreateObject("ADODB.Recordset")
 SQL="select agency From agency"
 MyRS.Open SQL, DataConn,adOpenStatic

%>
<tr>
 <td>Select an Agency
 </td>
 <td>
<SELECT id=select1 name="text">
<OPTION Value="<%Response.Write MyRS(k).Name%>"<%Response.Write MyRS(k).Name%>></OPTION>
<%MyRS.MoveNext%>
<% Loop %>
</SELECT></t




Replies:
Posted By: TYSON
Date Posted: 30 May 2003 at 10:09am

I havent looked closely at your code but here's one thing i see wrong

<%Dim DataConn
  Dim SQL
  Dim MyRS
  Dim k

 Set DataConn=Server.CreateObject("ADODB.Connection")
 DataConn.Open Application("Connection2_ConnectionString")
 Set MyRS=Server.CreateObject("ADODB.Recordset")
 SQL="select agency From agency"
 MyRS.Open SQL, DataConn,adOpenStatic

%>
<tr>
 <td>Select an Agency
 </td>
 <td>
<SELECT id=select1 name="text">
<%Do While Not MyRS.EOF%>
<OPTION Value="<%Response.Write MyRS(k).Name%>"<%Response.Write MyRS(k).Name%>></OPTION>
<%MyRS.MoveNext%>
<% Loop %>
</SELECT></t



-------------
http://www.fuo-motorsports.com/ - http://www.fuo-motorsports.com/


Posted By: TYSON
Date Posted: 30 May 2003 at 10:10am
Might also help in the future if you post the error message you get aswell.

-------------
http://www.fuo-motorsports.com/ - http://www.fuo-motorsports.com/


Posted By: Bullschmidt
Date Posted: 31 May 2003 at 10:58pm

And here's a link that could be interesting:

Fill A ComboBox with DB Information by Joao Vieira - 4/15/1999
http://www.4guysfromrolla.com/webtech/041599-1.shtml - http://www.4guysfromrolla.com/webtech/041599-1.shtml



-------------
J. Paul Schmidt, Freelance ASP Web Developer
www.Bullschmidt.com - www.Bullschmidt.com
Classic ASP Design Tips, ASP Web Database Sample (Freely Downloadable)



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net