Click to See Complete Forum and Search --> : Load from database to a combo box


reeta82
August 24th, 2003, 09:20 PM
how to load the informations from database to a combo box using asp...eg:type of courses available...plz help

ZoSoo7
August 26th, 2003, 03:13 PM
Give this a try, also if you wanted to, you can place another
value from your recordset within the option tags value attribute in case you have a unique key for your display value

<%
dim oConn, oRs
set oRs = CreateObject("ADODB.Recordset")
set oConn = CreateObject("ADODB.Connection")

'set your connection string
oConn.open "sdfsdlfkhweohiefwhoifew"

set oRs = oConn.execute("Select fieldName from myTable")

response.write "<select name=''cboComboBox'>"

do while not oRs.eof
resposne.write "<option>" & oRs("fieldName") & "</option>"
oRs.movenext
loop
%>

reeta82
August 26th, 2003, 09:16 PM
thanks a lot......