Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DropDown In Alphabatized Order

Status
Not open for further replies.

LinuxGuy

Programmer
Nov 18, 2002
37
0
0
US
i need to make my Dropdown Show up in Alphabetical Order
when its displayed can someone help me ?? here is my Code
I use to display my Dropdown List...

<select type=&quot;text&quot; name=&quot;x_Customer&quot; value=&quot;X_Customer&quot;>
<%

strSQL2 = &quot;SELECT Company from Contacts&quot;
Dim rs
Set rs = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rs.Open strSQL2, conn, 3

If Not rs.EOF Then
Do Until rs.EOF %>
<option value=&quot;<%=rs(&quot;Company&quot;)%>&quot;><%=rs(&quot;Company&quot;)%></option>
<% rs.MoveNext
Loop
End If
rs.Close
%>
</select>
 
Use
strSQL2 = &quot;SELECT Company from Contacts order by Company&quot;
equivalent to
strSQL2 = &quot;SELECT Company from Contacts order by Company ASC&quot;

or

strSQL2 = &quot;SELECT Company from Contacts order by Company DESC&quot;

________
George, M
 
thanks :) im pretty new to SQL statments, thanks for helping
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top