Sorry for cross-posting this to microsoft.public.inetserver.asp.db - I
didn't know if that group saw much action.
Hi All,
I'm very new to ASP and am now working on an existing site that is
written in ASP. I'm trying to populate a dropdown box with the results of
a query. There is current code that does this but it populates with team
name whereas I want division name.
The database is set up as:
League - connected to - Division - connected to Team
I want to be able to have someone choose a league and then on the next
page populate a dropdown with all the divisions in that league.
Here is the working code.
<%sql = "SELECT division.name, team.id, team.name as team, [team-
division].season
from (([division-league]
inner join division on division.id = [division-league].division)
inner join [team-division] on [team-division].division = division.id)
inner join team on team.id = [team-division].team
where league=" & thisleague
cmd.CommandText = sql
rs.Open cmd, , 1,1
do while not rs.eof
seasonid = rs("season")%>
<option value="<%=rs("id")%>"><%=rs("team")%(<%=rs
("name")%>)
<%rs.movenext%>
<%loop
rs.close%>
I have tried many things but I think just changing the query as follows,
should work but have had no success.
<%sql = "SELECT division.name, division.id from [division-league],
division
where [division.league].id = division.id
and league=" & thisleague
Thanks,
Dave