WEB LISTING 4: VBScript Function to Build an HTML List Box from Resultset
<%
'
'-- to build the HTML list box from recordset
'
Function BuildActivityTreeListHTML( oRs )
Dim strListHTML
'--- initial statement
strListHTML = ""
'--- Determine whether zero nodes exist.
'--- Add dummy node, set the end of tag.
IF( oRs.EOF ) THEN
strListHTML = strListHTML + "” _
+ "(No data available)"
_ + " "
strListHTML = strListHTML + " "
BuildActivityTreeListHTML = strListHTML
EXIT Function
END IF
'--- Loop to parse the recordset and add node to list item.
WHILE( not oRs.EOF )
'--- Add item to list box by using tag.
strListHTML = strListHTML _
+ " " _
+ oRs.Fields("activity_description") _
+ " "
'--- Move to next record.
oRs.MoveNext
WEND
'--- end of tag marker for
strListHTML = strListHTML + " "
'--- Return the list box as an HTML string.
BuildActivityTreeListHTML = strListHTML
END Function
%>