I am trying to populate a drop-down listbox with the data from a table within my database and a blank line. The code I am using is as follows:
Fees Test<%'name the variablesDim dcGamelvlDim rsGamelvlDim OptionString'establish my connectionSet dcGamelvl = Server.CreateObject("ADODB.Connection")Set rsGamelvl = Server.CreateObject("ADODB.Recordset")dcGamelvl.Open "assignor"rsGamelvl.Open "SELECT * FROM gamelvl", dcGamelvl'fill my variables witht the table dataOptionString = ""Do Until rsGamelvl.EOF OptionString = OptionString &_ "" rsGamelvl.MoveNextLoop'close my connectionrsGamelvl.ClosedcGamelvl.CloseSet rsGamelvl = NothingSet dcGamelvl = Nothing%>
When I call up the ASP page, the page appears, but the dropdown box is empty. What am I doing wrong?
Your drop-down box is empty because you did not place any values in it.
An HTML drop-down box (a
If you notice your code, you are placing a ‘VALUE=’ property, but you have nothing between your tag pairs. So you have an empty list box.
Change your code to read:
OptionString = OptionString &_ ""