  | 
				VFP 愛用者社區 本討論區為 Visual Foxpro 愛用者經驗交流的地方, 請多多利用"搜尋"的功能, 先查看看有無前例可循, 如果還有不懂的再發問. 部份主題有附加檔案, 須先註冊成為社區居民才可以下載.   
				 | 
			 
		 
		 
	
		| 上一篇主題 :: 下一篇主題   | 
	 
	
	
		| 發表人 | 
		內容 | 
	 
	
		chanmy8
 
 
  註冊時間: 2008-02-19 文章: 3
 
  第 1 樓
  | 
		
			
				 發表於: 星期二 二月 19, 2008 9:43 am    文章主題: VFP 与MS SQL Server NVARCHAR | 
				     | 
			 
			
				
  | 
			 
			
				对不起,我不大会用华语来表达技术问题。所以一下加会以英文表达,多多原谅。
 
 
Hi,
 
I am enhancing my application to support internalization, VFP front end and MS SQL Server database, using remote view.
 
 
 I would like to allow user to store Chinese words for certain fields, such as employee name. I changed employee name field type to NVARCHAR. Now I can store Chinese words without problem.
 
 
However, I am facing problem when searching records using employee name via remote view. 
 
 
 	  | 代碼: | 	 		  | SELECT * FROM employees WHERE EmployeeName LIKE ?lcEmpName | 	  
 
 
I found that, VFP would generate SQL statement as below
 
 
 	  | 代碼: | 	 		  | exec sp_executesql N'SELECT * FROM Employees WHERE EmployeeName like @P1 ',N'@P1 char(3)','我%' | 	  
 
 
The query will not return any records. Instead, if I changed to SQL statement as below and run it manually will works
 
 
 	  | 代碼: | 	 		  | exec sp_executesql N'SELECT * FROM Employees WHERE EmployeeName like @P1 ',N'@P1 char(3)',[b]N[/b]'我%' | 	  
 
 
According to SQL Server online help, we are required to include the bolded N prefix to indicate the parameter as unicode. However, VFP doesn't include it.
 
 
May I know how could I solve this problem?
 
Or, do you have any alternate way to allow storing/retrieving Chinese words with VFP front, MS SQL Server backend?
 
 
Please advice. Thank you | 
			 
		  | 
	 
	
		| 回頂端 | 
		 | 
	 
	
		  | 
	 
	
		syntech
 
 
  註冊時間: 2003-05-16 文章: 4252 來自: Taipei,Taiwan
  第 2 樓
  | 
		
			
				 發表於: 星期二 二月 19, 2008 10:58 am    文章主題:  | 
				     | 
			 
			
				
  | 
			 
			
				應該是無解 (或 很難解)
 
 
nvarchar 是 unicode 字串欄位,
 
vfp 不支援 unocde 欄位,
 
所以要使用複雜的程序轉換資料. _________________ 如果公司有下列困擾:
 
1. 找不到便宜,快速,簡易的 生產排程軟體
 
2. 不知道如何快速排定 採購計劃
 
3. 成本抓不準,自己算比軟體算有用
 
4. 想學習系統規劃,想找系統架構的顧問
 
 
請聯絡我們,也許我們幫得上忙 | 
			 
		  | 
	 
	
		| 回頂端 | 
		 | 
	 
	
		  | 
	 
	
		chanmy8
 
 
  註冊時間: 2008-02-19 文章: 3
 
  第 3 樓
  | 
		
			
				 發表於: 星期二 二月 19, 2008 11:04 am    文章主題:  | 
				     | 
			 
			
				
  | 
			 
			
				Hi,
 
May I know, if your application support Chinese words data? SQL Server database? How do you do it?
 
 
Thank you | 
			 
		  | 
	 
	
		| 回頂端 | 
		 | 
	 
	
		  | 
	 
	
		Amking
 
 
  註冊時間: 2004-08-22 文章: 2
 
  第 4 樓
  | 
		
			
				 發表於: 星期五 三月 21, 2008 12:02 am    文章主題:  | 
				     | 
			 
			
				
  | 
			 
			
				| 可以使用Sys(987,.T.)将远程 Unicode 转到ANSI. | 
			 
		  | 
	 
	
		| 回頂端 | 
		 | 
	 
	
		  | 
	 
	
		 | 
	 
 
  
  	 
	    
  	   | 
 	
您 無法 在這個版面發表文章 您 無法 在這個版面回覆文章 您 無法 在這個版面編輯文章 您 無法 在這個版面刪除文章 您 無法 在這個版面進行投票 您 無法 在這個版面附加檔案 您 無法 在這個版面下載檔案
  | 
   
  
		 |