C#中的文本框接受Unicode文本 [英] textbox in c# to accept unicode text

查看:172
本文介绍了C#中的文本框接受Unicode文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个Win应用程序,其中包含一个文本框,我需要该文本框输入和保存任何语言的文本-具体取决于用户.

我已经将我的数据库设置为nvarchar,如果我直接将其粘贴到数据库中,则可以正常工作.我的问题是让文本框接受不同的语言,并使用LINQ将文本保存到MS SQL.

有任何建议吗?

Hi,

I have a win app that contains a text box which I require to input and save text in any language - depending on the user.

I have set my db to nvarchar and if I paste directly in db it works fine. My problem is getting the textbox to accept the different languages and save the text to MS SQL using LINQ.

Any suggestions please?

推荐答案

据我所知,TextBox将接受Unicode字符.

若要保存到SQL Server,请在文本前加上大写字母"N".

TextBox.Text =你好

伪代码保存到数据库
As far as I know the TextBox will accept unicode characters.

To save to SQL Server precede the text with an upper case ''N''.

TextBox.Text = Hello

Pseudo code to save to Database
SET Message = N''Hello''


这篇关于C#中的文本框接受Unicode文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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