标题: 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
页面导航:
本版实现了上一修正版未实现的功能, 就是整合 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
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&"
response.write "showby="
response.write showby_
response.write """>by letter</a>, <a href=""?sortby=hanzifirst&"
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 "&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 "&showby="
response.write number
response.write """>"
response.write number
response.write "</a> "
next
response.write "<a href=""?sortby="
response.write sortby_
response.write "&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
%>
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&"
response.write "showby="
response.write showby_
response.write """>by letter</a>, <a href=""?sortby=hanzifirst&"
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 "&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 "&showby="
response.write number
response.write """>"
response.write number
response.write "</a> "
next
response.write "<a href=""?sortby="
response.write sortby_
response.write "&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
%>