如何在数据库中插入古吉拉特语文本 [英] How to insert gujarati text in database

查看:72
本文介绍了如何在数据库中插入古吉拉特语文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

private void button1_Click(object sender, EventArgs e)
      {

      string constr = @"Data Source=GREATCOMPUTER\SQLSERVERS;Initial Catalog=test3;Integrated Security=True;Pooling=False";
          SqlConnection cn = new SqlConnection(constr);
          string str = "insert into tbl (Name) values(N'" + textBox1.Text + "')";
          SqlCommand cmd = new SqlCommand(str,cn);
          cn.Open();
          int i = cmd.ExecuteNonQuery();
          cn.Close();
          if (i != 0)
          {
              MessageBox.Show("Inserted.....");
          }


      }





我是什么尝试过:



i需要在数据库中插入古吉拉特语文本,但在该代码中只插入英文单词

如果我插入 કોમલ然后在此代码中插入数据库komal

i在数据库列数据类型中使用NVARCHAR,在文本框字体属性中使用古吉拉特语saral 1字体



What I have tried:

i need to insert Gujarati text in database but in that code only insert English word
if i insert "કોમલ" then it insert in database "komal" in this code
i use NVARCHAR in database column datatype and Gujarati saral 1 font in textbox font property

推荐答案

除了Richard所说的,还要检查你的数据库列定义:如果你将数据存储在VARCHAR列中,那么它将是ASCII而不是UNICODE。



同时检查显示代码以确保字体选择正确:如果使用西方字体,则不太可能显示古吉拉特语字符。
In addition to what Richard has said, also check your database column definition: if you are storing your data in a VARCHAR column, then it will be ASCII not UNICODE.

Also check the display code to ensure that the font selection is correct there: if you use a Western font, you are unlikely to get Gujarati characters displayed.


这篇关于如何在数据库中插入古吉拉特语文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆