开发者

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.

  1. Create a partial class that contains an property that spits out only the part you want.

  2. Create a varchar in the DB with only the part you want (a hack)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜