views:

36

answers:

1

I have Server, and a Client. I want to display Server Date in Crystal report Print field instead of local date of Client. How can I do that?

+2  A: 

You would have to return the server date from the SQL Server to your Crystal Report and replace the PrintDate field with your new field.

e.g

SQL

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

From dbo.MyTable

Replace {PrintDate} in the Crystal Report with {ServerDateTime} from the list of Database Fields

Barry
+1 Note that if the main dataset returns no records, the ServerDateTime will be unpopulated. One way around this would be to retrieve the ServerDateTime separately, in a subreport, although this is overkill where the report can be expected to return data
Mark Bannister
@Mark - Yes this is true. Another way would be to check in the SQL that at least one row is returned. If it isn't then you could return a row of `null` values along with the Server date time.
Barry