DATASET不会使用OleDb从数据库中检索瑞典语字符 [英] DATASET does not retrieve Swedish characters from the Database using OleDb
问题描述
当我尝试从数据库中将瑞典文字符(如ÖÅé)检索到数据集中时,通过调试查看数据集的值时,它会显示为ÖÅà .
如何正确检索数据?
我尝试了以下无效的方法:
1.在后面的代码中:
Hi,
When i try to retrieve swedish characters like Ö Å é from the database into the dataset, it is displayed as Ö Ã… é when I view the dataset values by debugging.
How do I correctly retrieve the data?
I have tried the following which didn''t work:
1. In code behind:
Dim currentCultureInfo As New CultureInfo("sv-SE")
dataSet.Locale = currentCultureInfo
2.在web.config中:
2. In web.config :
<globalizatio<n fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8" culture="sv-SE" uiCulture="en-US" />
请帮助我解决这个问题.
预先感谢!!!
Kindly help me sort this issue.
Thanks in Advance !!!
推荐答案
尝试UTF-32,因为UTF-8可能无法表示所有字符
try UTF-32 since UTF-8 might not be able to represent all the characters
2东西:
1)
您为文本字段设置了哪种数据类型?可能您需要NVARCHAR
而不是VARCHAR
2)
您需要对数据进行编码...
2 things:
1)
What kind of data type do you set for text fields? Probably you needNVARCHAR
instead ofVARCHAR
2)
You need to encode data...
要设置单个页面的编码,请设置@ Page指令的RequestEncoding和ResponseEncoding属性,如以下示例所示:
To set the encoding for an individual page, set the RequestEncoding and ResponseEncoding attributes of the @ Page directive, as shown in the following example:
<![CDATA[<%@ Page RequestEncoding="utf-8" ResponseEncoding="utf-8" %>]]>
查看相关链接:
http://msdn.microsoft.com/en-us/library/39d1w2xf%28v = vs.100%29.aspx [ ^ ]
在ASP.NET中使用字符编码 [ http://msdn.microsoft.com/en-us/library/system. text.encodinginfo.codepage.aspx [ ^ ]
有关ASP.NET编码和全球化的更多信息,您将在这里找到: http://msdn.microsoft.com/zh-CN/library/h6270d0z%28v=vs.100%29.aspx [
See related links:
http://msdn.microsoft.com/en-us/library/39d1w2xf%28v=vs.100%29.aspx[^]
Using Character Encoding in ASP.NET[^]
http://msdn.microsoft.com/en-us/library/system.text.encodinginfo.codepage.aspx[^]
More about encoding and globalization for ASP.NET, you''ll find here: http://msdn.microsoft.com/en-us/library/h6270d0z%28v=vs.100%29.aspx[^]
这篇关于DATASET不会使用OleDb从数据库中检索瑞典语字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!