Use this small code to populate a dropdown from a database tabel in an ASP page.
This Sub Routine will check for selected Record and mark as Selected
<% Option Explicit
' Let's populate a dropdown with
the User Names from
' UserInfo table where UserID 3
should be selected
' in the dropdown
Dim SelectedUserID
SelecteduserID = 3
' We will make a call to Sub Routine
PopulateDropDown
' which will select all users from
UserInfo table and
' populate a dropdown. This sub
routine will also check
' for selected user and marked as
SELECTED
Call PopulateDropDown(
SelectedUserID )
' *********************************
' Populate Drop Down Sub Routine
' ********************************* Sub PopulateDropDown(byVal SelectedUserID) Dim objConn Dim objRS Dim strSQL Dim UserID Dim UserName