SQL Server與ADO.Net資料類型對照

來源:互聯網
上載者:User
下表顯示了 .NET Framework 類型、DbType 和 SqlDbType 枚舉以及 SqlDataReader 的訪問器方法。
SQL Server 資料庫引擎類型 .NET Framework 類型 SqlDbType 枚舉 SqlDataReader SqlTypes 類型化訪問器 DbType 枚舉 SqlDataReader DbType 類型化訪問器
bigint Int64 BigInt GetSqlInt64 Int64 GetInt64
binary Byte[] VarBinary GetSqlBinary Binary GetBytes
bit Boolean Bit GetSqlBoolean Boolean GetBoolean
char String Char GetSqlString AnsiStringFixedLength, GetString
Char[] String GetChars
date
(僅適用 SQL Server 2008)
DateTime Date GetSqlDateTime Date GetDateTime
datetime DateTime DateTime GetSqlDateTime DateTime GetDateTime
datetime2
(僅適用 SQL Server 2008)
DateTime2 DateTime2 GetSqlDateTime DateTime2 GetDateTime
datetimeoffset
(僅適用 SQL Server 2008)
DateTimeOffset DateTimeOffset DateTimeOffset GetDateTimeOffset
decimal Decimal Decimal GetSqlDecimal Decimal GetDecimal
FILESTREAM 屬性 (varbinary(max) Byte[] VarBinary GetSqlBytes Binary GetBytes
float Double Float GetSqlDouble Double GetDouble
image Byte[] Binary GetSqlBinary Binary GetBytes
int Int32 Int GetSqlInt32 Int32 GetInt32
money Decimal Money GetSqlMoney Decimal GetDecimal
nchar String NChar GetSqlString StringFixedLength GetString
Char[] GetChars
ntext String NText GetSqlString String GetString
Char[] GetChars
numeric Decimal Decimal GetSqlDecimal Decimal GetDecimal
nvarchar String NVarChar GetSqlString String GetString
Char[] GetChars
real Single Real GetSqlSingle Single GetFloat
rowversion Byte[] Timestamp GetSqlBinary Binary GetBytes
smalldatetime DateTime DateTime GetSqlDateTime DateTime GetDateTime
smallint Int16 SmallInt GetSqlInt16 Int16 GetInt16
smallmoney Decimal SmallMoney GetSqlDecimal Decimal GetDecimal
sql_variant Object* Variant GetSqlValue * Object GetValue *
text String Text GetSqlString String GetString
Char[] GetChars
time
(僅適用 SQL Server 2008)
TimeSpan Time Time GetDateTime
timestamp Byte[] Timestamp GetSqlBinary Binary GetBytes
tinyint Byte TinyInt GetSqlByte Byte GetByte
uniqueidentifier Guid UniqueIdentifier GetSqlGuid Guid GetGuid
varbinary Byte[] VarBinary GetSqlBinary Binary GetBytes
varchar String VarChar GetSqlString AnsiString, String GetString
Char[] GetChars
xml Xml Xml GetSqlXml Xml

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.