Print Page | Close Window

combobox filled with database data

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=14525
Printed Date: 30 March 2026 at 11:43am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: combobox filled with database data
Posted By: t.vdplaats
Subject: combobox filled with database data
Date Posted: 02 April 2005 at 7:06am
Can anybody tell me how I can fill a combobox with database dat??
 
I have a combobox with these settings:
 
 <form name="framecombo">
        <div align="center"><br>
<select name="framecombo2" size=1 class="menunormal">
<option value="link. http:// - asp?NewsID=34 " selected>Selecteer...</option>
<option value="link http:// - .asp?NewsID=42">Acne</option >
<option value="link. http:// - asp?NewsID=52">Couperose</option >
<input type="button" value="Zoek aandoening" onClick="jumpbox()" class="menunormal">
 
      <div align="left">
        <script language="javascript">
<!--
//set below variable to "1" to open combo in another frame, "2" to open in full window (parent window)
var openmode=1
//if above set to 1, specify the name of the frame you wish the combo to load in below
var targetframe="vlak"
function jumpbox(){
var destination=eval("window.parent."+targetframe)
var thebox=document.framecombo
if (openmode==2)
destination=window.parent
destination.location=
thebox.framecombo2.options[thebox.framecombo2.selectedIndex].value
}
//-->
</script>
 
The list is about 60 items long which I have to update manually... :-(
 
I'd like to get the listing from de database and the title as the option...
 
Can anybody tell me how to do this??
 
Thanx!
 
Taco



Replies:
Posted By: ub3rl337ch3ch
Date Posted: 04 April 2005 at 12:58am
set vrec = server.createobject("ADODB.Recordset")
set adoCon = server.CreateObject("ADODB.Connection")
 
...
 
<select name="framecombo2" size=1 class="menunormal">
<%
sql = "SELECT optionvalue, optionname FROM tablename"
vrec.open sql, adoCon
Do Until vrec.eof
%>
<option name="framecombo2" value="<%= vrec("optionvalue")%>"><%=vrec("optionname")%></option>
<%
loop
%>
</select>



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