Crystal reports 将Crystal Report PrintDate字段更改为SqlServer日期

Crystal reports 将Crystal Report PrintDate字段更改为SqlServer日期,crystal-reports,Crystal Reports,我有服务器和客户端。我想在Crystal report打印字段中显示服务器日期,而不是客户端的本地日期。 我该怎么做?您必须将SQL server中的服务器日期返回到Crystal报表中,并用新字段替换PrintDate字段 e、 g SQL Select Col1, Col2, ... GetDate() as 'ServerDateTime' From dbo.MyTable 将Crystal报表中的{PrintDate}替换为数据库字段列表中的{ServerDateTime},+1请注

我有服务器和客户端。我想在Crystal report打印字段中显示服务器日期,而不是客户端的本地日期。
我该怎么做?

您必须将SQL server中的服务器日期返回到Crystal报表中,并用新字段替换PrintDate字段

e、 g

SQL

Select Col1,
Col2,
...
GetDate() as 'ServerDateTime'

From dbo.MyTable

将Crystal报表中的
{PrintDate}
替换为数据库字段列表中的
{ServerDateTime}

+1请注意,如果主数据集未返回任何记录,ServerDateTime将不被填充。解决这一问题的一种方法是在子报表中单独检索ServerDateTime,尽管在报表可能返回的地方这是一种过分的做法data@Mark-是的,这是真的。另一种方法是在SQL中检查是否至少返回了一行。如果不是,则可以返回一行
null
值以及服务器日期时间。