Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

asp.net + crystal reports: problem with date fields query

Status
Not open for further replies.

mmy1981

Programmer
Apr 2, 2007
164
BE
Hi,
I'm having an issue with a webapplication and can't seem to trace the error since the results are different on my laptop and on a windows server.

Info is stored into an access database (accdb), including a field "mydate", type date/time - short date format.
The regional settings of my laptop and another machine (win server) are: "Belgium" / "Dutch" / shortdate format = "d/MM/yyyy" (settings in the control panel)

An ASP.net page shows a search form, including a datepicker (using the CalendarExtender from the Ajax control toolkit). The results of the search are shown in a crystal report.

Test on my laptop (correct results)
search for records where mydate = 10/03/2014 --> shows the crystal report with the correct results, mydate is shown as 10/03/2014 (71 pages)
search for records where mydate = 3/10/2014 --> shows the crystal report with the correct results, mydate is shown as 3/10/2014 (2 pages - I added some records with this date for testing purpose)


same test on the server -> results are switched:
search for records where mydate = 10/03/2014 --> shows the crystal report with results 3/10/2014: mydate is shown as 3/10/2014 (2 pages)
search for records where mydate = 3/10/2014 --> shows the crystal report with results 10/03/2014: mydate is shown as 10/03/2014 (71 pages)


So, on the server the day and month seem to switch in the search query (I guess). However, I have no idea why since the code is exactly the same on both machines...
In the web.config file, there's nothing to overrule the regional settings... On my laptop, I can open the access file to check the values and they seem ok. On the server, access isn't installed, so I cannot check if the date is into another format there.


 
Your regional settings are incorrect on your web server. This could either be the default for the server or a user account account on the server.
 
I logged on to the server with the same account as the webapplication was installed.
The regional settings are the same as on my laptop. But, is it possible that the default regional settings are different than the current settings displayed?
 
Yes you need to ensure that the regional settings are cascaded down to all users on the server
 
keayfjgn, thanks for the help.
I logged on to the server again, went to the regional settings in the control panel (short date was still correct), but used the administrative tab to copy the settings to the welcome screen and new user accounts.
After the necessary reboot it seems ok.

But I still don't understand why... The user account I used to connet to the server had already the correct regional settings. The webapplication was installed under this user account, and the webapp is accessed using Or is this site accessed using the network (or asp.net) user account maybe?

Anyway, thanks again. This will already help me in future projects too.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top