Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking a Drop Down Menu to a Database

Status
Not open for further replies.

AJ1982

Technical User
Jun 13, 2001
644
GB
I have been told this is an ASP issue, but Im not sure.

I am trying, in FrontPage2000, to link the data source of a drop down menu (As you would in Access) to a database but there is no option to do it. Which bring me to using ASP

Does anyone know where the code examples or help for this issue is

Any help is greatly appreciated

Thankyou
 
Here is an example of how you would do this:
Code:
<%
dim con, rs
set con = server.createObject(&quot;ADODB.Connection&quot;)
set rs = server.createObject(&quot;ADODB.Recordset&quot;)
con.open (&quot;DSN=myDSN;UID=uid;PWD=pwd&quot;)
rs.open &quot;SELECT * FROM tableName&quot;, con
%>

<select name=theDropDown>
<option value=none>SELECT ONE</option>
<%
while not rs.eof
  response.write(&quot;<option value=&quot; & rs(&quot;colName&quot;))
  response.write(&quot;>&quot; & rs(&quot;colName&quot;) & &quot;</option>&quot; & vbcr)
  rs.moveNext
wend
set rs = nothing
set con = nothing
%>
</select>

hope that helps! :)
Paul Prewett
penny.gif
penny.gif
 
THnaks for the information provided

I am totally useless at ASP, could you please demonstrate where the database file would be located within the above code as I have tried it in MyDSN and get a script error/not found.

Thanks

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top