对于你的方法已给一建议:
你可以用二维数组啊,现保存如“王”这样的姓,再保存“王xx”、“王x”

解决方案 »

  1.   

    得到汉字拼音第一个字母的算法。可能用在查询或排序
    <%
    function getpychar(char)
    tmp=65536+asc(char)
    if(tmp>=45217 and tmp<=45252) then getpychar= "A"
    if(tmp>=45253 and tmp<=45760) then getpychar= "B"
    if(tmp>=47761 and tmp<=46317) then getpychar= "C"
    if(tmp>=46318 and tmp<=46825) then getpychar= "D"
    if(tmp>=46826 and tmp<=47009) then getpychar= "E"
    if(tmp>=47010 and tmp<=47296) then getpychar= "F"
    if(tmp>=47297 and tmp<=47613) then getpychar= "G"
    if(tmp>=47614 and tmp<=48118) then getpychar= "H"
    if(tmp>=48119 and tmp<=49061) then getpychar= "J"
    if(tmp>=49062 and tmp<=49323) then getpychar= "K"
    if(tmp>=49324 and tmp<=49895) then getpychar= "L"
    if(tmp>=49896 and tmp<=50370) then getpychar= "M"
    if(tmp>=50371 and tmp<=50613) then getpychar= "N"
    if(tmp>=50614 and tmp<=50621) then getpychar= "O"
    if(tmp>=50622 and tmp<=50905) then getpychar= "P"
    if(tmp>=50906 and tmp<=51386) then getpychar= "Q"
    if(tmp>=51387 and tmp<=51445) then getpychar= "R"
    if(tmp>=51446 and tmp<=52217) then getpychar= "S"
    if(tmp>=52218 and tmp<=52697) then getpychar= "T"
    if(tmp>=52698 and tmp<=52979) then getpychar= "W"
    if(tmp>=52980 and tmp<=53640) then getpychar= "X"
    if(tmp>=53689 and tmp<=54480) then getpychar= "Y"
    if(tmp>=54481 and tmp<=52289) then getpychar= "Z"
    end functionfunction getpy(str)
    for i=1 to len(str)
    getpy=getpy&getpychar(mid(str,i,1))
    next
    end function
    %>
    再在数据库里面加上一个字段是eName("英文缩写"),在录入员工姓名的时候同时调用函数getpy(str),把得到的结果放进数据库。这样的话,以后就知道该如何操作了吧?
    不仅可以实现二级的排序(就是名字的第二个字首字母也可以进行排序),还提高了运行速度。
    对于你以前的数据,你可以自己写一个函数,把eName这个字段填充起来,不难吧?(也许数据量太大,会运行上一阵子,你可以放在下班的时候:))你还可以进行扩展,让中英文名字混合查询(通过一个IF Else语句就可解决的),是吧?我说得很简略,其实为了实现这个功能,你比我更清楚怎么做:)
    其它的我就不多说了,我想你清楚的很。
      

  2.   

    谢谢各位,smuzy的函数很好使
    但是网页中怎么实现呢?
      

  3.   

    RSExecute
    你在本论坛就可以搜索到相关内容