LISTING 1: Alternative ASP Code to Populate Drop-Down List for Table AB2
Please choose a size:
<% Dim ItemID, Connect, sqlstr, RS, strOptions, arySizes, cnt
ItemID=101
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open "ToysDSN", "sa", ""
sqlstr = "Select * from AB2 where itemid=" & ItemID
Set RS = Connect.Execute(sqlstr)
if not rs.eof then
strOptions = ""
arySizes= split(rs("Options"),",",-1)
for cnt = 0 to ubound(arySizes)
strOptions = strOptions & "" & vbcrlf
next
end if
%>