Results 1 to 10 of 10
  1. #1
    Join Date
    Mar 2003
    Posts
    32

    Question Unanswered: how to create listing record using alphabet

    hi,

    i have no idea to create this code acctualy i have already done create db listing record using number for paging, but my user want listing record by alphabet. i think if i'm create every page from a - z does not efisiyen. so can u help me out.


    thank

  2. #2
    Join Date
    Jan 2003
    Location
    Midwest
    Posts
    138
    do you mean you want to display the letters A - Z and have them as links (or something like that) so that when the user clicks on a letter, they see all records starting with that particular letter? if so you could do something like this

    Code:
    for a = 65 To 90 	
       Response.write("<a href='somepage'>" & chr(a) & "</a>nbsp;nbsp")
    next
    nbsp; should be with an & sign at the beginning, but it wouldn't display correctly in this post...so I took out the & sign so you would see that it needs to be there to have spaces between the characters.

    It will look like this on the page mansiononmain.com/listings.asp
    Last edited by Memnoch1207; 05-12-03 at 12:54.

  3. #3
    Join Date
    Mar 2003
    Posts
    32
    ya..that right Memnoch1207. i'm still begineer to understand this code if your dont mind pls give me some more that related to database. i really respect for that..big thanks

  4. #4
    Join Date
    Jan 2003
    Location
    Midwest
    Posts
    138
    explain exactly what you are trying to accomplish...and i'll see what i can do to help you out.

  5. #5
    Join Date
    Mar 2003
    Posts
    32
    what is your example in mansiononmain.com/listings.asp is what i want to do. but i have no idea how to create paging after we lisiting the table then i just know to listing table just using do while command only, i really confuse for using for command, that why if you have completed code like example you give so it easy to me to come out. thanks for your concern

  6. #6
    Join Date
    Feb 2002
    Location
    San Francisco, CA
    Posts
    441
    something like this?

    Code:
    for a = 65 To 90 	
       Response.write("<a href=""" & request.querystring("url") & "?page=" & chr(a) &""">" & chr(a) & "</a>nbsp;|nbsp")
    next
    
    
    set conn=Server.CreateObject("ADODB.Connection")
    conn.Provider="your provider string"
    set rs = Server.CreateObject("ADODB.recordset")
    
    you need to change this select statement, putting in your own tables and column names
    rs.Open "Select * from {put your table name here} where  {put your column name here} like '" & request.querystring("page") & "%'", conn
    
    if not(rs.bof) then
     do until rs.EOF
    
    you could remove this bit, it just lists all the fields in the RS
        for each x in rs.Fields
           Response.Write "<p>" & x.name & "<br />" & x.value & "</p>"
        next
        Response.Write "<br />"
        rs.MoveNext
     loop
    else
     response.write "Please select a letter"
    end if
    rs.close
    conn.close
    set rs=nothing
    set conn=nothing
    Last edited by rhs98; 05-16-03 at 05:19.

  7. #7
    Join Date
    Jan 2003
    Location
    Midwest
    Posts
    138
    I have attached a file that contains all the code (i think) you should need...It is the code from a site I created awhile back (http://usachambers.com/neosho/directory.asp)
    Attached Files Attached Files

  8. #8
    Join Date
    Jan 2003
    Location
    Midwest
    Posts
    138
    BTW...I use a templating system...so you won't see any html code in the attachment above...It is all vbscript code.

  9. #9
    Join Date
    Mar 2003
    Posts
    32

    Talking

    thank you,thank you all..it's work i'm using code where rhs98 manipulate from this first code Memnoch1207 giving. all the code i'm manipulate with html code. thanks rhs98 and big thanks Memnoch1207 your code 100% pure asp.

  10. #10
    Join Date
    Feb 2002
    Location
    San Francisco, CA
    Posts
    441
    thats my job!

Posting Permissions

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