PDA

View Full Version : Load from database to a combo box


sasi
08-24-03, 09:06 PM
how to load the informations from database to a combo box using asp...eg:type of courses available...plz help

Shane
08-24-03, 10:30 PM
This will work...

Modify the html code if you have to. Also, replace the SQL statement in the conn.Execute call.

<select name="list">
<%
' Note: conn is your connection object
Set RS = conn.Execute("select column_name from table")

If Not RS.EOF Then

Do Until RS.EOF
Response.Write("<option>" & RS("column_name") & "</option>")
RS.MoveNext
Loop

End If

RS.Close
Set RS = Nothing

conn.Close
Set conn = Nothing

%>

</select>