超难问题,牛人请进!解决立给分!

葫芦的世界 2006-08-03 02:56:45
让用户在输入框中输入字母“C”,则从数据库中调出所有以“C”为首字母的汉字。

例如:输入字母“D”,则下拉列表框中显示出所有以声母“D”为开头的词,如:大智若愚。

这个如何实现,望高手指点。
...全文
392 24 打赏 收藏 转发到动态 举报
写回复
用AI写文章
24 条回复
切换为时间正序
请发表友善的回复…
发表回复
jiangsh100 2006-08-04
  • 打赏
  • 举报
回复
多一个字段匹配中文字段的名称的声母
smartcatiboy 2006-08-04
  • 打赏
  • 举报
回复
>>>>nole2000(兰特)
>>>>nole2000(兰特)
>>>>nole2000(兰特)

大大,能否给一个中文字符和拼音对应的参考。
soft_2008 2006-08-04
  • 打赏
  • 举报
回复
- -
xiaoyaowp 2006-08-04
  • 打赏
  • 举报
回复
不错,顶
zhangjincheng88 2006-08-04
  • 打赏
  • 举报
回复
学习。。
边城的刀声 2006-08-04
  • 打赏
  • 举报
回复
学习
nole2000 2006-08-04
  • 打赏
  • 举报
回复
<%
function getpychar(char)
tmp=65536+asc(char)
if(tmp>=45217 and tmp<=45252) then
getpychar= "A"
elseif(tmp>=45253 and tmp<=45760) then
getpychar= "B"
elseif(tmp>=45761 and tmp<=46317) then
getpychar= "C"
elseif(tmp>=46318 and tmp<=46825) then
getpychar= "D"
elseif(tmp>=46826 and tmp<=47009) then
getpychar= "E"
elseif(tmp>=47010 and tmp<=47296) then
getpychar= "F"
elseif(tmp>=47297 and tmp<=47613) then
getpychar= "G"
elseif(tmp>=47614 and tmp<=48118) then
getpychar= "H"
elseif(tmp>=48119 and tmp<=49061) then
getpychar= "J"
elseif(tmp>=49062 and tmp<=49323) then
getpychar= "K"
elseif(tmp>=49324 and tmp<=49895) then
getpychar= "L"
elseif(tmp>=49896 and tmp<=50370) then
getpychar= "M"
elseif(tmp>=50371 and tmp<=50613) then
getpychar= "N"
elseif(tmp>=50614 and tmp<=50621) then
getpychar= "O"
elseif(tmp>=50622 and tmp<=50905) then
getpychar= "P"
elseif(tmp>=50906 and tmp<=51386) then
getpychar= "Q"
elseif(tmp>=51387 and tmp<=51445) then
getpychar= "R"
elseif(tmp>=51446 and tmp<=52217) then
getpychar= "S"
elseif(tmp>=52218 and tmp<=52697) then
getpychar= "T"
elseif(tmp>=52698 and tmp<=52979) then
getpychar= "W"
elseif(tmp>=52980 and tmp<=53688) then
getpychar= "X"
elseif(tmp>=53689 and tmp<=54480) then
getpychar= "Y"
elseif(tmp>=54481 and tmp<=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
response.write getpy("测")
%>
得到C

希望对你有帮助。
jnzsk 2006-08-04
  • 打赏
  • 举报
回复
你在输入汉字时把汉字的第一个字的拼音也输入进去!然后查询拼音的第一个字母!
chinagkk1984 2006-08-04
  • 打赏
  • 举报
回复
个人也认为用AJAX来实现起来,会比较快:)
yutian130 2006-08-04
  • 打赏
  • 举报
回复
按声母排序就OK了。。
再加上ajax...
擒兽 2006-08-03
  • 打赏
  • 举报
回复
mark
ice241018 2006-08-03
  • 打赏
  • 举报
回复
学习
itzhiren 2006-08-03
  • 打赏
  • 举报
回复
我这里有汉字转拼音的,就像iamxiang说的那样,不过不用数据库
葫芦的世界 2006-08-03
  • 打赏
  • 举报
回复
iamxiang,这位兄弟的想法自然是不错。可是这样做就太麻烦了。因为我们要事先建立相对应的关系,这要求大量的输入。所以,此方法不考虑。但还是感谢“iamxiang”
baihailong 2006-08-03
  • 打赏
  • 举报
回复
上面的大哥哥,能不能简单介绍一下这段程序的原理!
LunTanZeng 2006-08-03
  • 打赏
  • 举报
回复
不是难事!
懂原理,就可实现
葫芦的世界 2006-08-03
  • 打赏
  • 举报
回复
langrenkk,太感谢了。可是偶不太懂呀。

有没有简单点的????

因为,我不用SQLSERVER数据库呀。
iamxiang 2006-08-03
  • 打赏
  • 举报
回复
数据库:
名称 汉字缩写
大一 DY
小二 XE

再用程序读就出来了!
取首字拼音的程序很多!
teacher1998 2006-08-03
  • 打赏
  • 举报
回复
杨风79 2006-08-03
  • 打赏
  • 举报
回复
取汉字拼音首字母的存储过程:
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

加载更多回复(4)

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧