Adding/using a ListboxDTC to do comboboxes is pretty easy. Honest. And it gives a handy object model for traversing the list, adding in extra items etc.
Add a database connection via the Global.ASA (right click it!)
Add a recordset DTC to your page. Put in parameters as question marks (?) in the where clause. And test it. Set the recordset to NOT auto-open (third tab) if it has parameters.
Add a listboxDTC, pick the recordset, and the two columns on the SECOND parameter tab.
Add a PageObjectDTC. This makes life a tiny bit easier.
You can now add a function that runs each time the page opens:
Sub thisPage_onenter()
if thisPage.firstEntered then
'page initialisation
'populate combo boxes...
' passing in any parameters...
'rsList.setParameter 0, "a value"
rsList.open
'combo box will now be populated, so rs can be closed
rsList.close
'add any additional items...
cmbMyCombo.addItem '<please select>', -1, -1
end if
end sub
The item list is only fetched once from the database, and is cached as a hidden field on the page - so you only need to open the recordset once.
If you need to refresh the combo-list then you must clear the list first (cmbMyCombo.clear) before re-opening the recordset.
The
(Content Management)