Use SQL Server time datatype in C#.NET application?

后端 未结 5 595
轮回少年
轮回少年 2020-12-03 09:53

How does one use the SQL time datatype introduced in SQL Server 2008 in C#.NET?

I\'ve been trying to get it to work but no success.

5条回答
  •  眼角桃花
    2020-12-03 10:13

    How are you accessing the data? Using Entity Frameworks, StoredProcedures etc.
    If you have to pass a string representation of the date make sure that you do it in the format "yyyy-mm-dd hh:mm:ss" otherwise you will run the risk of the dd/mm/yyyy vs mm/dd/yyyy confusion. If you are using Entity Framework or DataSets then you should just pass the parameter a DataTime instance eg DateTime.Now

提交回复
热议问题