ASP ACCESS 按漢字拼音尋找與排序 By Stabx, 第三版

來源:互聯網
上載者:User


標題: ASP ACCESS 按漢字拼音尋找與排序 By Stabx, 第三版

本文:

QUOTE:

ASP ACCESS Pinyin ORDER BY SHAWL.QIU

本版實現了上一修正版未實現的功能, 就是整合 URL 查詢參數, 現在合了. 
使用 select case 實現.

功能:
1. 實現了一個也不能少的按照字母 尋找漢字與英文
2. 只按數字尋找
3. 尋找不屬於 漢字,英文,數字 的資料
4. 升序或降序查看, 升序查看為 英文在前, 降序查看為 漢字在前

查詢 URL 如:
./array_py5.asp?sortby=letterfirst&showby=B
./array_py5.asp?sortby=letterfirst&showby=0
./array_py5.asp?sortby=letterfirst&showby=other

頁面導航:

CODE:
shawl.qiu<shawl.qiuATgmail.com>
綠色學院 | http://blog.csdn.net/btbtd/
2006-6-4

first sort: by letter, by Pinyin

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 

0 1 2 3 4 5 6 7 8 9 other

CODE:

<%'shawl.qiu code | <shawl.qiuATgmail.com> | 綠色學院 | http://blog.csdn.net/btbtd/
        sortby_=request("sortby"):showby_=request("showby")
    if showby_="" then showby_="A" end if
    if sortby_<>"" then
        if sortby_="letterfirst" then
            orderby_="asc"
        else orderby_="desc"
        end if
    else sortby_="letterfirst":orderby_="asc"
    end if
        
    select case showby_
        case "A"
            py=array("A","阿","八")
        case "B"
            py=array("B","八","擦")
        case "C"
            py=array("C","擦","搭")
        case "D"
            py=array("D","搭","鵝")
        case "E"
            py=array("E","鵝","發")
        case "F"
            py=array("F","發","嘎")
        case "G"
            py=array("G","嘎","哈")
        case "H"
            py=array("H","哈","機")
        case "I"
            py=array("I","I","I")
        case "J"
            py=array("J","機","咖")
        case "K"
            py=array("K","咖","拉")
        case "L"
            py=array("L","拉","呣")
        case "M"
            py=array("M","呣","嗯")
        case "N"
            py=array("N","嗯","哦")
        case "O"
            py=array("O","哦","怕")
        case "P"
            py=array("P","怕","七")
        case "Q"
            py=array("Q","七","然")
        case "R"
            py=array("R","然","撒")
        case "S"
            py=array("S","撒","他")
        case "T"
            py=array("T","他","挖")
        case "U"
            py=array("U","U","U")
        case "V"
            py=array("V","V","V")
        case "W"
            py=array("W","挖","西")
        case "X"
            py=array("X","西","呀")
        case "Y"
            py=array("Y","呀","匝")
        case "Z"
            py=array("Z","匝","做祚")
    end select
    
        response.write "first sort: <a href=""?sortby=letterfirst&amp;"
        response.write "showby="
        response.write showby_
        response.write """>by letter</a>, <a href=""?sortby=hanzifirst&amp;"
        response.write "showby="
        response.write showby_
        response.write """>by Pinyin</a><p/>"
    
        letters="A B C D E F G H I J K L M N O P Q R S T U V W X Y Z" 
        numbers="0 1 2 3 4 5 6 7 8 9"
        
    for  each letter in split(letters)
        response.write "<a href=""?sortby="
        response.write sortby_
        response.write "&amp;showby="
        response.write letter
        response.write """>"
        response.write letter
        response.write "</a> "
    next
        response.write "<p/>"
    for  each number in split(numbers)
        response.write "<a href=""?sortby="
        response.write sortby_
        response.write "&amp;showby="
        response.write number
        response.write """>"
        response.write number
        response.write "</a> "
    next
        response.write "<a href=""?sortby="
        response.write sortby_
        response.write "&amp;showby=other"">other</a> "
        response.write "<p/>"
        
    if  cstr(showby_)>cstr(9) and cstr(showby_)<>"other"  then
        sql="select * from ctarticle where (title between '"&py(1)&"' and '"&py(2)&"') or title like '"&_
        py(0)&"%'  order by title "&orderby_
    elseif cstr(showby_)="other" then
        sql="select * from ctarticle where (title not between '阿' and '做祚') and title like '[!a-z0-9]%'  order by title "&orderby_
    else sql="select * from ctarticle where title like '"&showby_&"%' order by title "&orderby_
    end if
    
    set rs=server.CreateObject("adodb.recordset") 
        rs.open sql,MM_conn_string,1
            response.write  rs.recordcount
            response.write "<p/><ol>"
        do while not rs.eof 
            response.write "<li> "
            response.write rs("title")
            response.write "</li>"
            rs.movenext
        loop
            response.write "</ol>"
        rs.close 
    set rs=nothing  
%>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.