天那,有些汉字同音字可多了。
不过楼主已经知道方法了,具体实施还得有个同音对照表。。

解决方案 »

  1.   

    就是这个表我找不到,而且找到如何进行转换也是一个难题,还要求数据库内容录入时将录入内容转换成拼音再存一遍用来搜索,还请各位程序高手帮忙啊!!!
      

  2.   

    难道就没有别的办法实现这个功能,太假了吧·····
      

  3.   

    这个不是需要找一个表,不然你需要多查一次数据库
      

  4.   

    能不能说一下具体过程,多谢!!
      

  5.   

    看具体需要,比如是产品搜索,如果只会对产品名用到拼音,有个比较有效的方法就是在表中添加一个字段来存放产品的拼音缩写,这个用ascii码对照转换来实现很简单。下面的是网上一个asp取汉字首字母的函数。查询的时候同时搜索产品名称和这个拼音缩写的字段就可以了。效率方面不会有影响。<%
    '//获取汉字的首字母
    function getpychar(char)
    dim tmpp:tmpp=65536+asc(char)
     if(tmpp>=45217 and tmpp<=45252) then 
     getpychar= "A"
    elseif(tmpp>=45253 and tmpp<=45760) then
     getpychar= "B"
    elseif(tmpp>=45761 and tmpp<=46317) then
     getpychar= "C"
    elseif(tmpp>=46318 and tmpp<=46825) then
     getpychar= "D"
    elseif(tmpp>=46826 and tmpp<=47009) then 
     getpychar= "E"
    elseif(tmpp>=47010 and tmpp<=47296) then 
     getpychar= "F"
    elseif(tmpp>=47297 and tmpp<=47613) then 
     getpychar= "G"
    elseif(tmpp>=47614 and tmpp<=48118) then
     getpychar= "H"
    elseif(tmpp>=48119 and tmpp<=49061) then
     getpychar= "J"
    elseif(tmpp>=49062 and tmpp<=49323) then 
     getpychar= "K"
    elseif(tmpp>=49324 and tmpp<=49895) then 
     getpychar= "L"
    elseif(tmpp>=49896 and tmpp<=50370) then 
     getpychar= "M"
    elseif(tmpp>=50371 and tmpp<=50613) then 
     getpychar= "N"
    elseif(tmpp>=50614 and tmpp<=50621) then 
     getpychar= "O"
    elseif(tmpp>=50622 and tmpp<=50905) then
     getpychar= "P"
    elseif(tmpp>=50906 and tmpp<=51386) then 
     getpychar= "Q"
    elseif(tmpp>=51387 and tmpp<=51445) then 
     getpychar= "R"
    elseif(tmpp>=51446 and tmpp<=52217) then 
     getpychar= "S"
    elseif(tmpp>=52218 and tmpp<=52697) then 
     getpychar= "T"
    elseif(tmpp>=52698 and tmpp<=52979) then 
     getpychar= "W"
    elseif(tmpp>=52980 and tmpp<=53640) then 
     getpychar= "X"
    elseif(tmpp>=53689 and tmpp<=54480) then 
     getpychar= "Y"
    elseif(tmpp>=54481 and tmpp<=62289) then
     getpychar= "Z"
    else '如果不是中文,则不处理
     getpychar=char
    end if
    end function 
    '//生成汉字串首字母串
    function getpy(str)
    for i=1 to len(str)
     getpy=getpy & getpychar(mid(str,i,1))
    next
    end function
    %>
    调用时只要 str = getpy(str);
    取汉字拼音原理类似。可以稍加改进即可。