使用存储过程从sqlserver检索阿拉伯值,不给出任何值 [英] Retriving Arabic Value from sqlserver using stored procedure not giving any values

查看:71
本文介绍了使用存储过程从sqlserver检索阿拉伯值,不给出任何值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hai,
 i am trying to get the Arabic matched values from the DataBase using  stored procedure in sqlserver 2008..
But it didn't returns the matched values.. why..

My Table Design is like


CREATE TABLE #test1
(
col1 nVARCHAR(100)  ,
col2 nVARCHAR(100)  ,
col3 NVARCHAR(100)
)

INSERT INTO #test1 VALUES(N'لا أتكلم العربية',N'لا أتكلم العربية',N'لا أتكلم العربية')

INSERT INTO #test1 VALUES( ' fdfdf', 'dfdfdf', '45dfdf')

SELECT * FROM #test1


它很好地显示了结果,如下所示...


it showing the result like below well...

col1	col2	col3
لا أتكلم العربية	لا أتكلم العربية	لا أتكلم العربية
 fdfdf	dfdfdf	45dfdf




给定的查询给出确切的结果,而我正在搜索阿拉伯语单词..




The given query giving the exact results while i am searching for the Arabic words..

declare @ColVal nvarchar(100)
 set @ColVal=   N'لا أتكلم العربية'
print @ColVal
select * from #test1 where col2 like @ColVal




但是,当我尝试使用存储过程检索相同的数据时,即使它们存在于表中,它也不会再显示匹配记录.

我的存储过程是





But when i trying to retrieve the same data using the Stored Procedure it doesn''t showing the Matched records any more even they exist in table..

My stored Procedure is


create proc Sp_TestArabic1 (@colValue nvarchar(100))
as
declare @ColVal nvarchar(100)
begin
set @ColVal=  'N'+@colValue
print @ColVal
select * from #test1 where col2 like @ColVal
end





exec Sp_TestArabic1 'لا أتكلم العربية'



没有给出任何结果,我尝试调试存储的过程,所有列都很好地传递了值,但是它没有返回正确的结果..


请提供根据条件搜索阿拉伯语单词的准确解决方案...

谢谢..



Doesn''t give any results , I tried with debugging the Stored porcedure, all the columns passes the values well but it doesn''t returns the Correct results..


please provide exact solution to search the Arabic words based on the Condition...

Thank you..

推荐答案

从C#代码执行过程时,您需要传递带有"N"前缀的参数. 像这样
exec Sp_TestArabic1 N''لاأتكلمالعربية''

确保参数值应使用阿拉伯语,而不是N''???????
While executing the procedure from C# code, you need to pass parameter with ''N'' prefix.
like this
exec Sp_TestArabic1 N''لا أتكلم العربية''

Make sure the parameter value should be in arabic, not N''????''


这篇关于使用存储过程从sqlserver检索阿拉伯值,不给出任何值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆