-
Problem with Select
Hi!
I am trying to fill a combo box from an Access base, the code below is working:
<form method="POST" action="show_salary.asp">
Seller<br>
<select name="seller">
<option selected>Choose!</option>
<%
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open "driver={Microsoft Access Driver (*.mdb)};dbq=C:\Inetpub\wwwroot\test\Bas 1.mdb"
Set RecSet = Server.CreateObject("ADODB.Recordset")
Visa = "SELECT Seller, ID FROM Contract2000 Order By ID"
RecSet.Open Visa, Connect, adOpenStatic
While NOT RecSet.EOF
%>
<option value="<%=RecSet("Seller")%>"><%=RecSet("Seller")% ></option>
<%
RecSet.MoveNext
WEND
%>
</select>
<%
Set RecSet = NOTHING
Connect.Close
%>
The problem I have is that in the table, Seller, the same name are showing more than 1 time.
How can I do to make it showing only one time in the combo box??
Peter
-
Peter,
SELECT distinct Seller, max(ID)
FROM Contract2000
group by Seller
order by max(ID)
Jeff
-
Thanks JBane, I will try that
Peter
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|