devxlogo

Populating ListBox from Recordset Values

Populating ListBox from Recordset Values

Question:

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" &_                        ""             rsGamelvl.MoveNextLoop'close my connectionrsGamelvl.ClosedcGamelvl.CloseSet rsGamelvl = NothingSet dcGamelvl = Nothing%>

Game Level

When I call up the ASP page, the page appears, but the dropdown box is empty. What am I doing wrong?

Answer:

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 &_                         ""
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist