Version

SqlTypeMap Class

Provides support for mapping Sql-specific data types to their respective .NET framework counterparts.
Syntax
'Declaration
 
Public Class SqlTypeMap 
public class SqlTypeMap 
Remarks

A type map is used primarily for informative purposes, so that the developer can easily determine the .NET data type of a column in a database table.

The indexer for this class is settable, i.e., the developer can change the .NET data type to which a given database-specific type is mapped. This feature exists only to support complex development scenarios, and is intended to be used carefully and only in situations where a straightforward conversion between types is possible.

For example, a developer might want to remap a data type that is not CLS-compliant (such as an unsigned short integer) to a type that is, and is certain that data will not be corrupted by the conversion process.

The following table lists the default type conversion for each SqlDbType constant:

SqlDbType .NET Type
BigInt Int64
Binary Byte[]
Bit Boolean
Char String
DateTime DateTime
Decimal Decimal
Float Double
Image Byte[]
Int Int32
Money Decimal
NChar String
NText String
NVarChar String
Real Single
UniqueIdentifier Guid
SmallDateTime DateTime
SmallInt Int16
SmallMoney Decimal
Text String
Timestamp Byte[]
TinyInt Byte
VarBinary Byte[]
VarChar String
Variant Object
Xml String
Udt Object
Structured Object
Date DateTime
Time TimeSpan
DateTime2 DateTime
DateTimeOffset DateTimeOffset

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also