C# to SQL Server 2000 datatype mappings

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
 
F

Frans Bouma [C# MVP]

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


--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top