Csharp/C Sharp/Database ADO.net/SQL Data Type

Материал из .Net Framework эксперт
Перейти к: навигация, поиск

Shows the SQL server types, the corresponding Sql types, and the GetSql*** methods used to read a column as the Sql type

<source lang="csharp"> Sql* TYPE VALUES

===================================================================

Sql Binary A variable-length string of binary data. SqlBoolean An integer with either a 1 or 0 value. SqlByte An 8-bit unsigned integer value between 0 and 2^8 - 1 (255). SqlDateTime A date and time between 12:00:00 AM January 1, 1753 and 11:59:59 PM December 31, 9999. This is accurate to 3.33 milliseconds. SqlDecimal Fixed precision and scale numeric value between -1038 + 1 and 1038 - 1. SqlDouble A 64-bit floating-point number between -1.79769313486232E308 and 1.79769313486232E308 with 15 significant figures of precision. SqlGuid A 128-bit integer value (16 bytes) that that is unique across all computers and networks. SqlInt16 A 16-bit signed integer between -2^15 (-32,768) and 2^15 - 1 (32,767). SqlInt32 A 32-bit signed integer between-2^31 (-2,147,483,648) and 2^31 - 1 (2,147,483,647). SqlInt64 A 64-bit signed integer between -2^63 (-9,223,372,036,854,775,808) and 2^63 - 1 (9,223,372,036,854,775,807). SqlMoney A currency value between -922,337,203,685,477.5808 and 922,337,203,685,477.5807. This is accurate to 1/10,000th of a currency unit. SqlSingle A 32-bit floating-point number between -3.402823E38 and 3.402823E38 with seven significant figures of precision. SqlString A variable-length string of characters.

      </source>


SQL SERVER TYPES, COMPATIBLE Sql* TYPES, AND GetSql* METHODS

<source lang="csharp"> SQL SERVER TYPE Sql* TYPE GetSql* METHOD bigint SqlInt64 GetSqlInt64() int SqlInt32 GetSqlInt32() smallint SqlInt16 GetSqlInt16() tinyint SqlByte GetSqlByte() bit SqlBoolean GetSqlBoolean() decimal SqlDecimal GetSqlDecimal() numeric SqlDecimal GetSqlDecimal() money SqlMoney GetSqlMoney() smallmoney SqlMoney GetSqlMoney() float SqlDouble GetSqlDouble() real SqlSingle GetSqlSingle() datetime SqlDateTime GetSqlDateTime() smalldatetime SqlDateTime GetSqlDateTime() char SqlString GetSqlString() varchar SqlString GetSqlString() text SqlString GetSqlString() nchar SqlString GetSqlString() nvarchar SqlString GetSqlString() ntext SqlString GetSqlString() binary SqlBinary GetSqlBinary() varbinary SqlBinary GetSqlBinary() image SqlBinary GetSqlBinary() sql_varient object GetSqlValue() timestamp SqlBinary GetSqlBinary() uniqueidentifier SqlGuid GetSqlGuid()

      </source>