Is there A Way To Save A SmallDateTime In The DB As A Time Only
开发者_高级运维I have created a smalldatetime field. I am using a dbml file to access that field. Can I either in the dbml file or the db cut the date part out of the datetime and only leave the time with out having to effect anything else (such as having to change types for example)
No. A datetime
always has a date
component. You would need to use the time
datatype.
Before this existed a lot of people just use a date of 0 (1st January 1900) when they were only interested in storing times.
You have to option.
Create a partial class that contains an property that spits out only the part you want.
Create a varchar in the DB with only the part you want (a hack)
精彩评论