c#和sql中的数据类型是什么 [英] What is the Data type in c# and sql

查看:93
本文介绍了c#和sql中的数据类型是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在c#中声明£符号并将其存储在Sql中。

这是c#中使用的最佳数据类型和sql中的值。

I need to declare "£" symbol in c# and store it in Sql.
Which is the best data type to use in c# and the value in sql.

推荐答案

它必须是NVARCHAR数据类型 - 否则你不能存储这些特殊符号。

确保你真的像这样使用它:

It must be NVARCHAR datatype - otherwise you cannot store those special symbols.
Make sure you really use it like this:
@Symbol NVARCHAR(8) OUTPUT 
SqlParameter resultValue = new SqlParameter("@Symbol", SqlDbType.NVarChar, 8);



见以下链接的更多详情

http://www.fileformat.info /info/unicode/char/a3/index.htm [ ^ ]

http://www.theasciicode.com.ar/extended-ascii-code/pound-sign-symbol-pound-sterling-ascii-code-156.html [ ^ ]


要存储这些类型的编码字符或符号......你可以在sql中使用'nvarchar'数据类型...

和c#你可以试试这个



INSERT INTO table_name VALUES(N'£');
To store these type of encoding characters or symbols... you can use 'nvarchar' datatype in sql...
and for c# you can try like this

"INSERT INTO table_name VALUES(N'£')";


这篇关于c#和sql中的数据类型是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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