populate Combobox from database, but skip blanks
Posted on 2005-05-03
I have a database of usernames with corrosponding real names. I want to populate a combobox so I user can select their name from it. When I build the box it also gives me all the blank names where I don't have real user names listed. I put in the if statement you see, but it doesn't work. If I put a real name in it will skip it so I know the statement works, it's just the blanks that don't. Is there another way to reference a blank entry in a database other than ""?
Set Conn = Server.CreateObject("ADODB.Connection")
<p>Title: <select size="1" name="title">
<option selected>--Select a User--</option>
sql = "SELECT Name FROM Users"
oRS.Open sql, Conn,1,2
Do While Not oRS.EOF
if oRS.Fields("Name").Value = " " then
Response.Write"<Option Value= '" & oRS("Name") &"'>"
Response.Write oRS("Name") & "</option>"