对于以下SQL Server数据类型,C#中对应的数据类型是什么?

Exact Numerics

bigint
numeric
bit
smallint
decimal
smallmoney
int
tinyint
money

Approximate Numerics

float
real

Date and Time

date
datetimeoffset
datetime2
smalldatetime
datetime
time

Character Strings

char
varchar
text

Unicode Character Strings

nchar
nvarchar
ntext

Binary Strings

binary
varbinary
image

Other Data Types

cursor
timestamp
hierarchyid
uniqueidentifier
sql_variant
xml
table

(来源:MSDN)

推荐答案

这是SQL Server 2005美元.该表有SQL Server 2008SQL Server 2008 R2SQL Server 2012SQL Server 2014的更新版本.

SQL Server数据类型及其属性.NET框架类似功能

下表列出了Microsoft SQL Server数据类型、System.Data.SqlTypes命名空间中SQL Server公共语言运行时(CLR)中的等效数据类型,以及Microsoft SQL Server中的本机CLR等效数据类型.NET框架.

SQL Server data type CLR data type (SQL Server) CLR data type (.NET Framework)
varbinary SqlBytes, SqlBinary Byte[]
binary SqlBytes, SqlBinary Byte[]
varbinary(1), binary(1) SqlBytes, SqlBinary byte, Byte[]
image None None
varchar None None
char None None
nvarchar(1), nchar(1) SqlChars, SqlString Char, String, Char[]
nvarchar SqlChars, SqlString String, Char[]
nchar SqlChars, SqlString String, Char[]
text None None
ntext None None
uniqueidentifier SqlGuid Guid
rowversion None Byte[]
bit SqlBoolean Boolean
tinyint SqlByte Byte
smallint SqlInt16 Int16
int SqlInt32 Int32
bigint SqlInt64 Int64
smallmoney SqlMoney Decimal
money SqlMoney Decimal
numeric SqlDecimal Decimal
decimal SqlDecimal Decimal
real SqlSingle Single
float SqlDouble Double
smalldatetime SqlDateTime DateTime
datetime SqlDateTime DateTime
sql_variant None Object
User-defined type(UDT) None user-defined type
table None None
cursor None None
timestamp None None
xml SqlXml None

.net相关问答推荐

DotNet COM初始化问题

当数据大量分布在微服务中时,我应该如何设计后端?

使用 PowerShell 从文件夹中获取文件名的最快\最好的方法是什么?

如何在选项卡中 Select Winforms NumericUpDown 中的所有文本?

C#.Net 中的可选返回

使用 IIS Express 托管网站(临时)

编译错误:显式实现接口时修饰符 'public' 对此项目无效

如何找到 ManualResetEvent 的状态?

Java 和 .NET 技术/框架的类似物

如何遍历字典并更改值?

Await 运算符只能在 Async 方法中使用

向 .NET 应用程序添加脚本功能

何时使用抽象类?

.NET 进程间通信的最佳 Select 是什么?

.NET 的黄瓜替代品

找不到库 hostpolicy.dll

如何使用通用扩展方法中的字符串列名在 IQueryable 上应用 OrderBy?

具有不同身份验证标头的 HttpClient 单个实例

ConfigurationManager.AppSettings - 如何修改和保存?

C# 应用程序中的资源和嵌入式资源有什么区别?