请问日本明星和韩国明星按字母查找,SQL应该怎么写,还有应该用什么控件来显示。有做过的,给点建议,代码能否分享一下,先谢谢各位大虾了,在线等。。

解决方案 »

  1.   

    不明白的可以参照这个网站
    http://www.kugou.com/top/singer/singertype_2_5.htm拜托各位了
      

  2.   

    估计要用嵌套的控件
    group by 查询的数据
      

  3.   

    我现在是用Repeater控件来显示的
    但是还有些按字查询的SQL不会写,日韩的,这个要按拼音的首字母发音,这种SQL该怎么写呢
      

  4.   

    sql server里面好像有个取汉字首字母的功能,你可以按这个来排序就行了:
    select * from 表名 order by fun_getPY(明星名字字段)取汉字拼音首字母的存储过程
    Create  function fun_getPY 

        @str nvarchar(4000) 

    returns nvarchar(4000) 
    as 
    begin   declare @word nchar(1),@PY nvarchar(4000)   set @PY=''   while len(@str)>0 
      begin 
        set @word=left(@str,1)     --如果非汉字字符,返回原字符 
        set @PY=@PY+(case when unicode(@word) between 19968 and 19968+20901 
                   then (  
                                select top 1 PY  
                                from  
                                (  
                                 select 'A' as PY,N'驁' as word 
                                 union all select 'B',N'簿' 
                                 union all select 'C',N'錯' 
                         union all select 'D',N'鵽' 
                         union all select 'E',N'樲' 
                         union all select 'F',N'鰒' 
                         union all select 'G',N'腂' 
                         union all select 'H',N'夻' 
                         union all select 'J',N'攈' 
                         union all select 'K',N'穒' 
                         union all select 'L',N'鱳' 
                         union all select 'M',N'旀' 
                         union all select 'N',N'桛' 
                         union all select 'O',N'漚' 
                         union all select 'P',N'曝' 
                         union all select 'Q',N'囕' 
                         union all select 'R',N'鶸' 
                         union all select 'S',N'蜶' 
                         union all select 'T',N'籜' 
                         union all select 'W',N'鶩' 
                         union all select 'X',N'鑂' 
                         union all select 'Y',N'韻' 
                         union all select 'Z',N'咗' 
                          ) T  
                       where word>=@word collate Chinese_PRC_CS_AS_KS_WS  
                       order by PY ASC 
                              )  
                          else @word  
                     end) 
        set @str=right(@str,len(@str)-1) 
      end   return @PY end 
      

  5.   

    我有欧美、日、韩,请问每种都要写26条SQL语句吗,有没有更好的方法,本人在线等
      

  6.   

    简单点可以直接用table绑定,其实你可以在建表的时候弄一列A,B,C...Z这样的  编号.SELECT的时候就按这个搜索绑定就可以了
      

  7.   

    直接order by不行的么? 这个排序规则sql服务器自己就能处理的吧。
      

  8.   

    sql服务器自己处理,太强了吧
      

  9.   

    可以把汉字传换成拼音
    http://topic.csdn.net/t/20061025/19/5109154.html
      

  10.   

    A-Z是我自己定义的图片:后面是显示查询的A-Z的内容
      

  11.   


    但是我不需要做下拉菜单因为我没有那么多的类型,我只要右边那一块,就是上面是A-Z字母,下面显示A-z显示的内容
      

  12.   

    http://www.kugou.com/top/singer/singertype_2_2.htm
    不明白我意思的可以参加上面的网页
      

  13.   

    新建一个字段,比如Pinyin,
    在录入人名的时候,使用js自动生成汉字的拼音首字母,
    这个js函数见
    http://blog.csdn.net/xuStanly/archive/2007/08/28/1761397.aspx但是多音字若与上下文不符,还得手动调整。