Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - help with creating a dropdown box
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

help with creating a dropdown box

 Post Reply Post Reply
Author
beginner View Drop Down
Newbie
Newbie


Joined: 22 May 2003
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote beginner Quote  Post ReplyReply Direct Link To This Post Topic: help with creating a dropdown box
    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

Back to Top
TYSON View Drop Down
Groupie
Groupie


Joined: 18 August 2002
Location: Australia
Status: Offline
Points: 142
Post Options Post Options   Thanks (0) Thanks(0)   Quote TYSON Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
TYSON View Drop Down
Groupie
Groupie


Joined: 18 August 2002
Location: Australia
Status: Offline
Points: 142
Post Options Post Options   Thanks (0) Thanks(0)   Quote TYSON Quote  Post ReplyReply Direct Link To This Post Posted: 30 May 2003 at 10:10am
Might also help in the future if you post the error message you get aswell.
Back to Top
Bullschmidt View Drop Down
Groupie
Groupie


Joined: 31 May 2003
Location: United States
Status: Offline
Points: 72
Post Options Post Options   Thanks (0) Thanks(0)   Quote Bullschmidt Quote  Post ReplyReply Direct Link To This Post 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

J. Paul Schmidt, Freelance ASP Web Developer
www.Bullschmidt.com
Classic ASP Design Tips, ASP Web Database Sample (Freely Downloadable)
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.