add "N" to command Parameters
as you can see in this post, I HAVE to add N in front of my varible to search on japanese or chinese.
calling the following sproc from the QA works fine like this:
TESTGETCAPLCO 'ja-JP', N'上海'
(whereas TESTGETCAPLCO 'ja-JP', '上海') will return no results.
But I want to call this stored procedure from my code. How do I add this N? I tried so many things allready, like "N" + keyword, etc:
C# Code
Code:
comm = new SqlCommand("TESTGETCAPLCO", this.conn);
comm.Parameters.Add("@lang", SqlDbType.NVarChar, 10).Value = lang;
comm.Parameters.Add("@keyword", SqlDbType.NVarChar, 255).Value = keyword;
comm.CommandType = CommandType.StoredProcedure;
SqlDataReader reader;
try
{
reader = comm.ExecuteReader();
STORED PROCEDURE:
Code:
alter proc TESTGETCAPLCO
@lang NVARCHAR(10),
@keyword NVARCHAR(255)
AS
set @keyword = '%' + @keyword + '%'
SELECT ID,
CASE
WHEN @lang = 'en-US' THEN coName_en
WHEN @lang = 'ja-JP' THEN coName_ja
WHEN @lang = 'zh-CN' THEN coName_zh
END
AS coName
FROM tblCAPLCompanies
WHERE
CASE
WHEN @lang = 'en-US' THEN coName_en
WHEN @lang = 'ja-JP' THEN coName_ja
WHEN @lang = 'zh-CN' THEN coName_zh
END
LIKE @keyword
Re: add "N" to command Parameters
What does the N actually mean? I'm going to make a slightly educated guess and say that you'll have to set the LocaleId property of the parameter.