ASP ACCESS 按汉字拼音查找与排序, 最终修正版 By Stabx

标题: ASP ACCESS 按汉字拼音查找与排序, 最终修正版 By Stabx

正文:

QUOTE:

ASP ACCESS 按汉字拼音查找与排序, 最终修正版 By Stabx
功能:
1. 实现了一个也不能少的按照字母 查找汉字与字母
2. 只按数字查找
3. 查找不属于 汉字,英文,数字 的数据
4. 升序或降序查看, 升序查看为 英文在前, 降序查看为 汉字在前

不足:
1. 查找数据关键字分为两个查询
1.1 byletter=数字, 为 查找 汉字与英文
1.2 other=数字/other, 为查找数字或不属于汉字,英文,数字
注: 由于使用了数组对象, 我是没办法把这两个查询合为一个了, 希望某位牛人把这两个查询合而为一, 前提是语法方法都要简洁. 

shawl.qiu
2006-5-28


导航:
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:

CITE:


附加:
A=array("A","阿","八")
B=array("B","八","擦")
C=array("C","擦","搭")
D=array("D","搭","鹅")
E=array("E","鹅","发")
F=array("F","发","嘎")
G=array("G","嘎","哈")
H=array("H","哈","机")
I=array("I","I","I")
J=array("J","机","咖")
K=array("K","咖","拉")
L=array("L","拉","呣")
M=array("M","呣","嗯")
N=array("N","嗯","哦")
O=array("O","哦","怕")
P=array("P","怕","七")
Q=array("Q","七","然")
R=array("R","然","撒")
S=array("S","撒","他")
T=array("T","他","挖")
U=array("U","U","U")
V=array("V","V","V")
W=array("W","挖","西")
X=array("X","西","呀")
Y=array("Y","呀","匝")
Z=array("Z","匝"," 做祚")

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../Connections/conn.asp" -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<title>绿色学院 Green Institute</title>
<link HREF="../css.css" REL="stylesheet" TYPE="text/css">
</head>
<body><br/>
<%'拼音4
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
' subject    : ASP ACCESS 按汉字拼音查找与排序, 最终修正版 By Stabx
'
' writer    : Stabx<[email]shawl.qiu@gmail.com[/email]>
'
' blog        : http://blog.csdn.net/btbtd / http://btbtd.exblog.jp/ 
'
' blog/site    : Phoenix.GI - P.GI / / 绿色学院 - Green Institute
'
' date        : 2006-5-28
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
dim py,py1,py2
redim py(25),py1(25),py2(25)
py(0)="阿"
py(1)="八"
py(2)="擦"
py(3)="搭"
py(4)="鹅"
py(5)="发"
py(6)="嘎"
py(7)="哈"
py(8)="I"
py(9)="机"
py(10)="咖"
py(11)="拉"
py(12)="呣"
py(13)="嗯"
py(14)="哦"
py(15)="怕"
py(16)="七"
py(17)="然"
py(18)="撒"
py(19)="他"
py(20)="U"
py(21)="V"
py(22)="挖"
py(23)="西"
py(24)="呀"
py(25)="匝"

py1(0)="八"
py1(1)="擦"
py1(2)="搭"
py1(3)="鹅"
py1(4)="发"
py1(5)="嘎"
py1(6)="哈"
py1(7)="机"
py1(8)="I"
py1(9)="咖"
py1(10)="拉"
py1(11)="呣"
py1(12)="嗯"
py1(13)="哦"
py1(14)="怕"
py1(15)="七"
py1(16)="然"
py1(17)="撒"
py1(18)="他"
py1(19)="挖"
py1(20)="U"
py1(21)="V"
py1(22)="西"
py1(23)="呀"
py1(24)="匝"
py1(25)="做祚" '做 5586/祚 7681

py2(0)="A"
py2(1)="B"
py2(2)="C"
py2(3)="D"
py2(4)="E"
py2(5)="F"
py2(6)="G"
py2(7)="H"
py2(8)="I"
py2(9)="J"
py2(10)="K"
py2(11)="L"
py2(12)="M"
py2(13)="N"
py2(14)="O"
py2(15)="P"
py2(16)="Q"
py2(17)="R"
py2(18)="S"
py2(19)="T"
py2(20)="U"
py2(21)="V"
py2(22)="W"
py2(23)="X"
py2(24)="Y"
py2(25)="Z"
     response.write "<p/>"
    
     byletter_=request("byletter")
     other_=request("other")
     sortby_=request("sortby")
    
     if sortby_<>"" then
             if sortby_="letterfirst" then
                     orderby_="asc"
             else
                     orderby_="desc"
             end if
     else
             sortby_="letterfirst"
             orderby_="asc"
     end if
    
     if byletter_<>"" then
             if         byletter_<=0 then
                                     byletter_=0
             elseif     byletter_>=25 then
                                     byletter_=25
             end if
     else
             byletter_=0
     end if
    
         response.write "first sort: <a href=?sortby=letterfirst&"
     if isempty(other_) then
         response.write "byletter="
         response.write byletter_
     else 
         response.write "other="
         response.write other_
     end if
         response.write ">by letter</a>, <a href=?sortby=hanzifirst&"
     if isempty(other_) then
         response.write "byletter="
         response.write byletter_
     else 
         response.write "other="
         response.write other_
     end if
         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"
         j=0    
     for  each letter in split(letters)
         response.write "<a href=?sortby="
         response.write sortby_
         response.write "&byletter="
         response.write j
         response.write ">"
         response.write letter
         response.write "</a> "
         j=j+1
     next
         response.write "<p/>"
     for  each number in split(numbers)
         response.write "<a href=?sortby="
         response.write sortby_
         response.write "&other="
         response.write number
         response.write ">"
         response.write number
         response.write "</a> "
     next
         response.write "<a href=?sortby="
         response.write sortby_
         response.write "&other="
         response.write "other"
         response.write ">"
         response.write "other"
         response.write "</a> "
        
         response.write "<p/>"
        
     if  request("byletter")<>"" or isempty(other_) then
         sql="select * from ctarticle where (title between '"&py(byletter_)&"' and '"&py1(byletter_)&"') or title like '"&py2(byletter_)&"%'  order by title "&orderby_
     elseif other_<>"other" then
         sql="select * from ctarticle where title like '"&other_&"%'  order by title "&orderby_
     elseif other_="other" then
         sql="select * from ctarticle where (title not between '阿' and '做祚') and (title not like '[0-9a-z]%')" 
         'Access 中用 *, ASP 中用 %
         'Access: select * from ctarticle where (title not between '阿' and '做祚') and (title not like '[0-9a-z]*')
     end if
     set rs=server.CreateObject("adodb.recordset") '创建 rs 数据查询
         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 '关闭 rs 连接        
     set rs=nothing  %>
</body>
</html>

<script LANGUAGE="JAVASCRIPT"> function ClipBoard(tdObj) { //IE Only var holdtext = document.all['holdtext']; holdtext.innerText = tdObj.innerText; Copied = holdtext.createTextRange(); Copied.execCommand("Copy"); alert("text copied"); } </script>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值