Search Tools Links Login

Select List Thingy


*UPDATED 10-23-00* Now with more options, including multiple select, size, and default selected option. Quickly and easily creates select list combo boxes from a database for your web forms. Uses .GetString rather than recordset looping.

Original Author: Will Knoll

Inputs

See Code Comments...

Assumptions

I place the code in an include file which I link to from the pages in which I am building select lists. I use this with SQL Server, not sure what results will be with other databases, but it should work okay.

Returns

Returns a string with all of the code for your select list. All you need to do to display it is a Response.Write() or <%=varname%>

Side Affects

Your Recordset can only contain two columns for this to work properly. Example SQL: "SELECT usr_id,usr_name FROM users". The first column will be used for the VALUE of the option, the second column will be the display value.

Code

<%
'***************************************
'* Function Name: buildCombo
'* Syntax : myVar = buildCombo
'* Parameters :
'* rsRecordset - Name of an OPEN
'* recordset with 2 fields
'* strComboName - String with the name
'* you want to appear in
'* "
Else
strCombo = ""
exit function
End If
End With
strCombo = strCombo & ""
i = InStrRev(strCombo,"

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 96 times

Categories

ASP/ HTML

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.