C# to SQL Server 2000 datatype mappings

  • Thread starter Thread starter Mark Rae
  • Start date Start date
M

Mark Rae

Hi,

Can anyone please point me to a definitive mapping of SQL Server 2000
datatypes to C# datatypes?

I'm currently using the mapping below, but I'm sure some aren't correct...

BigInt, int
Binary, object
Bit, bool
Char, string
DateTime, DateTime
Decimal, decimal
Float, float ???
Image, object
Int, int
Money, decimal
NChar, string
NText, string
NVarChar, string
Real, float ???
SmallDateTime, DateTime
SmallInt, int
SmallMoney, decimal
Text, string
Timestamp, object ???
TinyInt, byte
UniqueIdentifier, object ???
VarBinary, object ???
VarChar, string
Variant, object ???


Any assistance gratefully received.

Mark
 
Mark said:
Hi,

Can anyone please point me to a definitive mapping of SQL Server 2000
datatypes to C# datatypes?

I'm currently using the mapping below, but I'm sure some aren't
correct...

BigInt, int
Binary, object
Bit, bool
Char, string
DateTime, DateTime
Decimal, decimal
Float, float ???
Image, object
Int, int
Money, decimal
NChar, string
NText, string
NVarChar, string
Real, float ???
SmallDateTime, DateTime
SmallInt, int
SmallMoney, decimal
Text, string
Timestamp, object ???
TinyInt, byte
UniqueIdentifier, object ???
VarBinary, object ???
VarChar, string
Variant, object ???


Any assistance gratefully received.

the mappings I use:
BigInt = System.Int64
Binary = System.Byte[]
Bit = System.Boolean
Char = System.String
Datetime = System.DateTime
Decimal = System.Decimal
Float = System.Double
Image = System.Byte[]
Int = System.Int32
Money = System.Decimal
NChar = System.String
NText = System.String
Numeric = System.Decimal
NVarChar = System.String
Real = System.Single
SmallDateTime = System.DateTime
SmallInt = System.Int16
SmallMoney = System.Decimal
Sql_Variant = System.Object
SysName = System.String
Text = System.String
TimeStamp = System.Byte[]
TinyInt = System.Byte
UniqueIdentifier = System.Guid
VarBinary = System.Byte[]
VarChar = System.String

FB


--
 
Back
Top