Comparison between SQL Server and ADO. Net Data Types

Source: Internet
Author: User
The following table lists the. NET Framework type, dbtype, sqldbtype enumeration, and sqldatareader accessors.
SQL Server database engine type . NET Framework type Sqldbtype Enumeration Sqldatareader sqltypes type accesser Dbtype Enumeration Sqldatareader dbtype type accessors
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 only)
Datetime Date Getsqldatetime Date Getdatetime
Datetime Datetime Datetime Getsqldatetime Datetime Getdatetime
Datetime2
(SQL Server 2008 only)
Datetime2 Datetime2 Getsqldatetime Datetime2 Getdatetime
Datetimeoffset
(SQL Server 2008 only)
Datetimeoffset Datetimeoffset None Datetimeoffset Getdatetimeoffset
Decimal Decimal Decimal Getsqldecimal Decimal Getdecimal
Filestream attributes (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 only)
Timespan Time None 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 None

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.