1. Database value to List Box
Open a database, Connect it, retrieve the values with sql and populate the Listbox with them.

set objConn=server.createobject("adodb.connection")
objConn.open "DSN=dbDSN;uid=username;pwd=password"
set rsValues=objConn.execute("select field
from table where )
do while not rsValues.eof %>
<option> <%=rsValues(0)%> </option>
set rsValues = nothing
set objConn=nothing


The code connectes the database, takes the values from the table and stores it in a recordset (rsValues). The values are added in to the option form filed one by one using the do…loop and the list has been populated. To use this code Modify the database connection details, and sql.

Back to code snippet home…

    * Macronimous.com does not use information collected in this form for any marketing purposes. Check our privacy policy here.