What are the most suitable equivalent C# data types for the date datatypes in SQL Server? I'm specifically looking for
date
time
datetimeoffset
c++sql-server-2008types
What are the most suitable equivalent C# data types for the date datatypes in SQL Server? I'm specifically looking for
date
time
datetimeoffset
Best Solution
Here are the equivalent CLR data types for
date
,time
anddatetimeoffset
SQL Server data types:date -
DateTime
,Nullable<DateTime>
time -
TimeSpan
,Nullable<TimeSpan>
datetimeoffset -
DateTimeOffset
,Nullable<DateTimeOffset>
Note that you can find a listing of all SQL Server data types and their CLR equivalents here, Mapping CLR Parameter Data