Wrox Home  
 
Search P2P Archive for  go

More Wrox Resources

  Return to Index  

asp_web_howto thread: Re: Empty Dynamic Select Box


Message #1 by "Tom Philo" <taphilo@b...> on Fri, 25 Jan 2002 21:36:22
<%

'declare our variables

Dim conn,sql,rs

'connect to db and open subcategory query

Set conn=Server.CreateObject("ADODB.Connection")

conn.open "DSN=photo"

sql="SELECT distinct Category from Photographs order by Category asc"

Set rs=conn.execute(sql)

   Do While Not rs.eof

         Response.Write "<option>" & rs("Category") & "</option>"

         rs.movenext

       Loop

   conn.close

   Set conn=Nothing

   Set rs=Nothing

%>



is what I did to get it to work.



Tom Philo

http://www.taphilo.com





> This is a multi-part message in MIME format.

> 

> ------=_NextPart_000_002D_01C18C9A.FB0BEEC0

> Content-Type: text/plain;

> 	charset="iso-8859-1"

> Content-Transfer-Encoding: quoted-printable

> 

> Experts,

> 

> I know that there is probably a simple answer, but how do I do this? I 

> have a dynamic select box (code below). It works fine. My Question is, 

> how do I make the select box read "Nothing Here" if there are no records 



> to retrieve?

> 

> Thanks In Advance

> John Miller

> 

> Code:

> <td width=3D"25%" valign=3D"top" align=3D"left"><select 

> name=3D"Activity">

> <% Do until rsTwo.EOF %>

> <option value=3D3D<%=3D rsTwo(1) %>> <%=3DrsTwo(6)%> </option>

> <%

> rsTwo.MoveNext

> Loop

> %></select></p></td>

> 

> 

  Return to Index