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
STORED PROCEDURE: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();
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


Reply With Quote
