SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast MeLoDi's Avatar
    Join Date
    Sep 2003
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question displaying from recordset

    hi there i have a set of details in the database that looks like this:
    Code:
    Name		 Number
    -------------------------
    ABC		 123456
    ABC		 128556
    ABC		 125559
    DFF		 559851
    DFF		 448715
    DFF		 154873
    how do i select then in such a way that they are display like this on the asp page:
    Code:
    ABC
    -------------------
    123456
    128556
    125559
     
    DFF 
    --------------------
    559851
    448715
    154873
    Any help would be greatly appreciated

  2. #2
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,737
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do u know about create a DSN Data source, either with ODBC or connection strings http://www.connectionstrings.com/

    then you could create a recordset and insert your values into your asp page.

    Do u understand ?

  3. #3
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this:
    Code:
    <%
    	SQL = "SELECT Name, Number FROM Table ORDER BY Name ASC, Number ASC"
    	Set RS = DB.Execute(SQL)
    	sName = ""
    	Do While Not RS.EOF
    		If RS.Fields("Name") <> sName Then
    			sName = RS.Fields("Name")
    			Response.Write sName & "<br/>" & "-----------------<br/>"
    		End If
    		Response.Write RS.Fields("Number") & "<br/>"
    		RS.MoveNext
    	Loop
    %>

  4. #4
    Original Gangster silver trophy Thing's Avatar
    Join Date
    Oct 2000
    Location
    Philadelphia, PA
    Posts
    4,708
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Remove this:

    Code:
    , Number ASC
    The number's in the example are not sorted ASC.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •