Populate a combo box with information from a database
Populate a combo box with information from a database
Rate Populate a combo box with information from a database
(3(3 Vote))
<SELECT NAME="ListBox" SIZE=1>
<% Set conn = Server.CreateObject("ADODB.Connection") %>
<% conn.Open "DSN=AdvWorks" ' connect to the database %>
<% Set rs = conn.Execute("SELECT City FROM Customers") %>
<% Do While Not rs.EOF ' define the ListBox OPTIONs %>
<OPTION VALUE="<%= rs("City") %>"> <%= rs("City") %>
<% rs.MoveNext %>
<% Loop %>
<% rs.Close %>
<% conn.Close %>
Populate a combo box with information from a database Comments
No comments yet — be the first to post one!
Post a Comment