[RESOLVED] SQL query & selection list

I need to to this:
Create an asp page that contains a form that contains an xhtml selection list containing all the customer names as the option text & the customer ID as the value for the option. The selection list should be created by running an SQL query to obtain the data from the database. I've come up with the following code which definitely not showing any customer names. cananyone help?

<% set conn =server.createobject("ADODB.connection")
conn.open "warehouse", "IWSDStudent", "assign2"
sql = "Select CustomerID, LastName from Customer"
set rs = conn.execute(sql)%>
</head>
<body>
<form method="get" action="task11.asp">
<%do while not rs.eof%>
<p> Select Customer's Last Name<br/>
Please choose only one:
<select name="name" size="1">
<optgroup label>
<option value="<%=rs("CustomerID")%>"<%=rs("LastName")%></option>
<% rs.movenext
loop

%>
</optgroup>
</select>

</p>
[1086 byte] By [shipwreck99] at [2007-11-20 11:28:12]
# 1 Re: [RESOLVED] SQL query & selection list
How does this really differ from your other post? Instead of putting contents in a table, you are putting them in <option> tags.
PeejAvery at 2007-11-10 3:56:12 >
# 2 Re: [RESOLVED] SQL query & selection list
BUt when i select one option & post it, it doesn't shows the records..
shipwreck99 at 2007-11-10 3:57:08 >
# 3 Re: [RESOLVED] SQL query & selection list
BUt when i select one option & post it, it doesn't shows the records..
Okay, now I am confused. It doesn't populate the <select> drop-down? Or once the form is posted back to the server, it doesn't show information concerning the selected user?

If the problem is with the second, then that is a whole different piece of code. We would need to see that.
PeejAvery at 2007-11-10 3:58:06 >
# 4 Re: [RESOLVED] SQL query & selection list
thanks i got it to work...
shipwreck99 at 2007-11-10 3:59:11 >
# 5 Re: [RESOLVED] SQL query & selection list
For the assistance of all other who read this, could you please post what you did?
PeejAvery at 2007-11-10 4:00:09 >
# 6 Re: [RESOLVED] SQL query & selection list
sorry forgot to check this thread..so here goes the changes i made to the initial code to get it to work:

<% 'set the connection to the db
sql = "Select distinct CustomerID, LastName from Customer"
set rs = conn.execute(sql)%>
</head>
<body>
<form id="customerform" action="task.asp" method="get">
<p> Select Customer's Last Name<br/>
Please choose only one:
<select name="custID" size="1" >
<%do while not rs.eof%>
<option value="<%=rs("CustomerID")%>"><%=rs("LastName")%></option>
<% rs.movenext
loop
%>
</select>
</p>
<p><input type="submit" value="Submit"/>
<input type="reset" value="Reset"/>
</p>
shipwreck99 at 2007-11-10 4:01:15 >