I have been trying my hardest to resolve this looking up the various different websites and articles however all the fixes suggested dont seem to work.
I am trying to interact with an Access MDB Database, through ASP using SQL queries on an IIS Web Server.
The issue comes when I want to input or compare a date.
I have tried setting all the regional settings (both in CP and RegEdit) on the IIS Server Machine to EN-GB and the date formats to match.
I have tried changing the LCID to 2057 for GB dates.
No matter what I try, it just doesnt seem to work.
One specific example is this
sSQLGP = "SELECT * FROM orders WHERE orderdate BETWEEN " & sStartDate & " AND " & sEndDate & " ORDER BY orderdate ASC"
sStartDate is set (for example) to #01/05/2011#
sEndDate is set (for example) to #31/05/2011#
Now when I try and echo the results for this query, I get results from the 5th Jan, not the 1st May
I even tried to split it apart using datepart so that it read 05/01/2011, however for some stupid reason, it returns the same results switching it back to 5th Jan!!!
The ONLY workaround I have, which is crazy and not ideal when dealing with dates across the entire code of the site is to SWITCH the LCID to 1033, build my dates into the variables, run the query and then SWITCH the LCID back to 2057
It is VERY frustrating and I can not believe that there is no real fix for this.
I know there must be something that can be done as until recently we used to have our domain hosted at FASTHOSTS, they offered support for dealing with MDB files and whenever I performed queries there, I used UK dates and didnt get a single problem. So if they can do it at a server level (since I didnt have to add any LCID changes or such when I used their servers) then there must be a way to set this at our server level.
I can use the workaround, but I shouldnt have to
I am trying to interact with an Access MDB Database, through ASP using SQL queries on an IIS Web Server.
The issue comes when I want to input or compare a date.
I have tried setting all the regional settings (both in CP and RegEdit) on the IIS Server Machine to EN-GB and the date formats to match.
I have tried changing the LCID to 2057 for GB dates.
No matter what I try, it just doesnt seem to work.
One specific example is this
sSQLGP = "SELECT * FROM orders WHERE orderdate BETWEEN " & sStartDate & " AND " & sEndDate & " ORDER BY orderdate ASC"
sStartDate is set (for example) to #01/05/2011#
sEndDate is set (for example) to #31/05/2011#
Now when I try and echo the results for this query, I get results from the 5th Jan, not the 1st May
I even tried to split it apart using datepart so that it read 05/01/2011, however for some stupid reason, it returns the same results switching it back to 5th Jan!!!
The ONLY workaround I have, which is crazy and not ideal when dealing with dates across the entire code of the site is to SWITCH the LCID to 1033, build my dates into the variables, run the query and then SWITCH the LCID back to 2057
It is VERY frustrating and I can not believe that there is no real fix for this.
I know there must be something that can be done as until recently we used to have our domain hosted at FASTHOSTS, they offered support for dealing with MDB files and whenever I performed queries there, I used UK dates and didnt get a single problem. So if they can do it at a server level (since I didnt have to add any LCID changes or such when I used their servers) then there must be a way to set this at our server level.
I can use the workaround, but I shouldnt have to