EntcatDataSource中的Concat两个DateTime字段

时间:2013-04-04 05:24:24

标签: casting entitydatasource entity-sql

我有两个Edm.DateTime类型的字段。如何以h:mm格式获取Time,并在EntityDataSource的CommandText中连接它们: “01/02/2013 3:15 AM和01/02/2013 4:15 AM”应为“15:15-16:15” 我找到了concat的演员,是不是正确的解决方案:

CommandText="SELECT  CAST([DoctorAppointment].[Start] AS System.String) + '--'+ CAST([DoctorAppointment].[End] AS System.String) 
         as Name FROM  DatabaseEntities.DoctorAppointments as DoctorAppointment"

1 个答案:

答案 0 :(得分:0)

Select="String.Format(it.[interview_start_date], 'dd/ MM/ YYYY') as Display,

这适合我。