[英]SQL Server Report Builder : Concatenate data type “date” and “time”
I am working with SQL Server Report Builder 2008 R2. 我正在使用SQL Server Report Builder 2008 R2。
I have a dataset that contains DateEntry (date, null)
and TimeStampAuto (time(7), null)
columns. 我有一个数据集,其中包含DateEntry (date, null)
和TimeStampAuto (time(7), null)
列。 I am trying to write an expression for concatenating those two values, so I can put it under DATETIME
column on the report table. 我正在尝试编写一个用于连接这两个值的表达式,因此可以将其放在报表表的DATETIME
列下。 I tried the following but it does not work. 我尝试了以下操作,但不起作用。 It displays "#Error." 它显示“ #Error”。
=First(Fields!DateEntry.Value, "Report1) & " " & First(Fields!TimeStampAuto.Value, "Report1)
When I just put the first part of the expression shown above, the report displays the date with some random time value (5/1/2015 12:00:00 AM). 当我仅放置上面显示的表达式的第一部分时,报告将显示带有一些随机时间值(2015年5月1日12:00:00 AM)的日期。 However, I did not put any time value in DateEntry
. 但是,我没有在DateEntry
放置任何时间值。 I only put the dates. 我只放日期。
When I put the second part of the expression shown above, the report displays correct time that the data has. 当我放置上面显示的表达式的第二部分时,报告将显示数据所具有的正确时间。
I don't know why I can not concatenate those two. 我不知道为什么不能将这两个连接在一起。
The system type of the DateEntry.Value
will be a DateTime value which is the readon that your report is showing 5/1/2015 12:00 AM
even though it is only a date field in the database. DateEntry.Value
的系统类型将是DateTime值,它是报表显示5/1/2015 12:00 AM
即使它只是数据库中的日期字段。
You need to format the date to only include the day,month and year to remove the included default time of 12:00 am
您需要格式化日期,使其仅包含日期,月份和年份,以删除包含的默认时间12:00 am
you will probably need to check for null
values in both your date and time fields. 您可能需要在日期和时间字段中检查null
值。 you will also need to format the time filed to exclude any default date information. 您还需要格式化提交的时间,以排除任何默认日期信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.