VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Populate a combo box with information from a database

by Anonymous (267 Submissions)
Category: Active Server Pages
Compatability: ASP (Active Server Pages)
Difficulty: Unknown Difficulty
Originally Published: Mon 25th January 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Populate a combo box with information from a database

Rate Populate a combo box with information from a database



<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 %>

Download this snippet    Add to My Saved Code

Populate a combo box with information from a database Comments

No comments have been posted about Populate a combo box with information from a database. Why not be the first to post a comment about Populate a combo box with information from a database.

Post your comment

Subject:
Message:
0/1000 characters