Print Page | Close Window

Drop Down Menus from a database

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=544
Printed Date: 29 March 2026 at 1:24pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Drop Down Menus from a database
Posted By: judo2000
Subject: Drop Down Menus from a database
Date Posted: 26 February 2003 at 1:16pm

This was addressed in another topic but it was a little different and I didn't really understand the answers anyway.
I have a web form that puts information tinto a table called employees.  I want to create a form that people can use from different venue can use to assign employees from the employees database to their venue database.  For example the JoyBurns(ice arena) table pulls emID (employeeID) from the employees table with a drop down menus.  So I can go to the database and open JoyBurns table and select an employee from a drop down menu which is populated from the employees menue.  What I can't figure out is how to get that drop down menu from the Joy Burns table into a web form so venue managers don't have to go into the database.  Any help will be greatly appreciated.

Thanks



-------------
If you are not willing to work hard to realize your dreams, why bother dreaming?



Replies:
Posted By: vdub
Date Posted: 02 March 2003 at 2:55am

<%
'Create  DSN Less connection to Access Database
'Create DBConnection Object
Set DBConnection = Server.CreateObject("adodb.connection")
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; "
DSN = DSN & "DBQ=" & Server.Mappath("/path_to_your/database.mdb")
DBConnection.Open DSN

'Count the Records

   SQLcount = "Select * From table"
      Set RS = DBConnection.Execute(SQLcount)

 

 Select Case RS.eof
      Case False
        tempRSCount = RS.getrows
        Set RS = Nothing
        count = Cdbl(UBound(tempRSCount, 2)) + 1
               
     Case True
      count = "0"
 End Select
     Set RS = Nothing
 

 

%>

         <select size="1" name="dropdown_name">
         <option value="choice 1">Pick one</option>

         <%
         IF count > 0 Then
      
'Display records

    
  SQL = "Select * From table"
      Set RS = DBConnection.Execute(SQL)
            
        rs.move idc
      
        while not rs.eof
         data1 = rs("data1")
         data2= rs("data2")
         idc = idc + 1
         %> 
         <option value="<%=data1%>"><%=data2%></option>
         <%
         
         rs.Movenext
        wend
       Else
       %>
       
         <option>no data to display</option><%
       End IF
  %>

Replace everything in red with your own data.




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