[英]How to save and retrieve foregin language(Malayalam ) datas in sql server 2008
I want to save Malayalam language datas in sql server 2008.I have installed Malayalam font in system and in my application i changed TextBox font into Malayalam. 我想在SQL Server 2008中保存Malayalam语言数据。我已经在系统中安装了Malayalam字体,在我的应用程序中,我将TextBox字体更改为Malayalam。 So it displayed in malayalam but actually its English letters.If am saving into database it stored in English,But i want to save TextBox value in Malayalam to database .
所以它显示在malayalam中,但实际上是英文字母。如果要保存到数据库中,它以英语存储,但是我想将Malayalam中的TextBox值保存到数据库中。
Please Help. 请帮忙。
Use nvarchar datatype in the tables which will store unicode data. 在表中使用nvarchar数据类型将存储unicode数据。
Make sure that your database calls also use nvarchar. 确保您的数据库调用也使用nvarchar。
I just followed my own style of coding. 我只是遵循自己的编码风格。 so please consider this when you follow me.
所以当您关注我时请考虑一下。
First I created the MySql database. 首先,我创建了MySql数据库。
after creating database, in mysql command prompt, give the command: 创建数据库后,在mysql命令提示符下,输入以下命令:
SET NAMES = UTF8; 集合名称= UTF8;
table and columns to store unicode are to be set with collation property as utf8-utf_general_ci. 存储Unicode的表和列将使用归类属性设置为utf8-utf_general_ci。 Each and every column which meant to store unicode, is to be selected and set collation property to utf8-utf_general_ci.
将选择要存储unicode的每一列,并将归类属性设置为utf8-utf_general_ci。
Now in C#. 现在在C#中。
my connection string is set as usual but with addition of a single attribute like this: 我的连接字符串照常设置,但添加了一个像这样的单个属性:
constring = @"SERVER=localhost;" constring = @“ SERVER = localhost;” + @"PORT=3306;"
+ @“ PORT = 3306;” + @"DATABASE=gayakidb;"
+ @“ DATABASE = gayakidb;” + @"UID=root;"
+ @“ UID = root;” + @"PASSWORD=mysql;"
+ @“ PASSWORD = mysql;” + @"charset=utf8;";
+ @“ charset = utf8;”;
Next, installed unicode font in the 'Display language setting' of your system OS. 接下来,在系统操作系统的“显示语言设置”中安装unicode字体。 Or, you can copy and paste the font file (true type file) in the Fonts folder of Operating System.
或者,您可以将字体文件(真实类型文件)复制并粘贴到“操作系统”的“字体”文件夹中。
Then I set the font property of the textbox object or any other tool object in property page. 然后,我在属性页中设置文本框对象或任何其他工具对象的font属性。
More over, if you need to type in unicode font using your keyboard, you need to install the unicode language for keyboard layout. 此外,如果您需要使用键盘输入Unicode字体,则需要安装Unicode语言以进行键盘布局。 That could be done using the option for regional language settings of your Operating System.
可以使用操作系统的区域语言设置选项来完成。
Done. 完成。 with these settings, i coded module for saving data and while running the ocde, it successfully done the work.
通过这些设置,我对用于保存数据的模块进行了编码,并在运行ocde时成功完成了工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.