|
| |
|
|
jorge
Posts: 31 Joined: 9/8/2003 Status: offline
|
Date problem when date used as parameter in Hyperlink - 9/19/2003 12:27:53
Hi, I have a very simple DRW page, it lists all the records of a table. That table has 2 fields. 1 field is a date. Now i created a hyperlink to a detailspage from that date. Here the problem begins: if the date is 01/01/2003 then everithing is ok. if the date is 17/01/2003 then everithing is ok. if the date is 01/02/2003 then it's not ok On my deatailspage i then get ""No records returned."" And i know that there should be a record with 01/02/2003 as date. if that table has a record with as date 02/01/2003 then this record will be showed instead of the correct one: 01/02/2003 I've read alot, CHanging LCID doesn't change a thing, it only changes the date format when displayed. Anyone can tell me whats happening here? tx Jorge
|
|
|
|
Long Island Lune
Posts: 2340 Joined: 6/8/2002 From: New York Status: offline
|
RE: Date problem when date used as parameter in Hyperlink - 9/19/2003 13:48:44
Post your SQL query line.
_____________________________
|
|
|
|
jorge
Posts: 31 Joined: 9/8/2003 Status: offline
|
RE: Date problem when date used as parameter in Hyperlink - 9/19/2003 14:47:17
Here it is: s-sql="SELECT * FROM wedstrijde WHERE (Datum = #::Datum::# AND Naam = '::Naam::')"
|
|
|
|
jorge
Posts: 31 Joined: 9/8/2003 Status: offline
|
RE: Date problem when date used as parameter in Hyperlink - 9/20/2003 12:06:23
The solution for all my date problems is this i think: ************************************************************ <% Function MediumDate( ByVal stringToCheck, ByVal defaultOut ) Dim dayPart Dim monthPart Dim yearPart If IsDate( stringToCheck ) Then dayPart = Day( stringToCheck ) monthPart = Monthname( Month( stringToCheck ), True ) yearPart = Year( stringToCheck ) MediumDate = dayPart & "-" & monthPart & "-" & yearPart Else MediumDate = defaultOut End If End Function %> ************************************************************ And here's an example of how to use it to get rid of your Date problems .... ********************************************************************************************************** sql = "UPDATE tblOrders " _ & "SET fldDateOrdered = # " & MediumDate( Date(), "Null" ) & " # " _ & "WHERE fldStatus = open ;" ************************************************************ But i don't know the syntax to use this in my query: s-sql="SELECT fldDateOrdered,productordered FROM tblOrders WHERE (fldDateOrdered = #::fldDateOrdered::#)" i've got exactly the same problem as discribed over here: http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_20638920.html
|
|
|
|
Long Island Lune
Posts: 2340 Joined: 6/8/2002 From: New York Status: offline
|
RE: Date problem when date used as parameter in Hyperlink - 9/20/2003 20:02:28
Did it work for you?
_____________________________
|
|
|
|
jorge
Posts: 31 Joined: 9/8/2003 Status: offline
|
RE: Date problem when date used as parameter in Hyperlink - 9/20/2003 21:19:20
No, i'm still searching for a solution. This is really a hard one for me the problem exist only when i use the date in a hyperlink to go to a page that has that date as criteria in the DRW I know that I should add a Function, or use FormatDateTime or Format, or whatever, but at the moment i don't know anymore where to begin. I'm to confused. Access and ASP AND dates other then US format are hell for me
|
|
|
|
Long Island Lune
Posts: 2340 Joined: 6/8/2002 From: New York Status: offline
|
RE: Date problem when date used as parameter in Hyperlink - 9/20/2003 22:23:43
To narrow down the problem, start at the beginning. The first thing you have to do is check the date value coming in to your DRW page and make sure it is being transferred correctly from the hyperlink. If it's not coming in correctly, anything you try won't work. Create a little ASP code right at the top of the DRW page and have it display the value being sent from that hyperlink.
_____________________________
|
|
|
|
jorge
Posts: 31 Joined: 9/8/2003 Status: offline
|
RE: Date problem when date used as parameter in Hyperlink - 9/20/2003 22:34:53
sorry, but how do i do that, ==> Create a little ASP code right at the top of the DRW page and have it display the value being sent from that hyperlink. If fldDateOrdered is the value
|
|
|
|
Long Island Lune
Posts: 2340 Joined: 6/8/2002 From: New York Status: offline
|
RE: Date problem when date used as parameter in Hyperlink - 9/21/2003 1:49:28
<%=request("fldDateOrdered")%> OR... <% test = Request.form("fldDateOrdered") response.write (test & "<BR>") %> OR... <% test = Request.QueryString("fldDateOrdered") response.write (test & "<BR>") %>
_____________________________
|
|
|
|
jorge
Posts: 31 Joined: 9/8/2003 Status: offline
|
RE: Date problem when date used as parameter in Hyperlink - 9/21/2003 7:08:24
If the date in the link i created from "fldDateOrdered" = 1/1/2003, then no problems If the date is 21/04/2003, then no problems But if the date is 01/04/2002, then my query doesn't know what are the days and what are the months <% test = Request.QueryString("fldDateOrdered") response.write (test & "<BR>") %> This i putted on top of my details page, It gives me the correct value, the value that it should be.always, even when 1/04/2002 is the date.
|
|
|
|
jorge
Posts: 31 Joined: 9/8/2003 Status: offline
|
RE: Date problem when date used as parameter in Hyperlink - 9/21/2003 11:13:05
I'm now trying to use that famous ISODATE function, but i can't get the right usage of it. s-sql="SELECT * FROM tblOrders WHERE fldDateOrdered = #" & ISODate(Session("fldDateOrdered")) & "#" " this is giving me a Syntax error in date in query expression 'fldDateOrdered = #'.
|
|
|
|
jorge
Posts: 31 Joined: 9/8/2003 Status: offline
|
RE: Date problem when date used as parameter in Hyperlink - 9/21/2003 11:33:23
another detail: When I putted <% test = Request.QueryString("fldDateOrdered") response.write (test & "<BR>") %> on top of my detailspage then something strange happend. then i saw the right date on top of the page, but the result from the query was incorrect(swapped days and months). So i assume that the problem is not the value given to the query, but the value that is coming out of the query
|
|
|
|
Long Island Lune
Posts: 2340 Joined: 6/8/2002 From: New York Status: offline
|
RE: Date problem when date used as parameter in Hyperlink - 9/21/2003 15:04:53
Is your DRW dieted with a spooky diet?
_____________________________
|
|
|
|
jorge
Posts: 31 Joined: 9/8/2003 Status: offline
|
RE: Date problem when date used as parameter in Hyperlink - 9/21/2003 15:07:49
No it isn't, do you think that is going to change anything here, i mean the problem with the dates
|
|
|
|
Long Island Lune
Posts: 2340 Joined: 6/8/2002 From: New York Status: offline
|
RE: Date problem when date used as parameter in Hyperlink - 9/21/2003 15:37:19
Well, it gives you more flexibility on how to attack any problem in a DRW. Here is a list of all VB functions including all date functions (bottom left side of page). I'm thinking maybe DateValue. http://www.devguru.com/Technologies/vbscript/quickref/vbscript_list.html s-sql="SELECT * FROM tblOrders WHERE fldDateOrdered = DateValue(fldDateOrdered)"
_____________________________
|
|
|
|
jorge
Posts: 31 Joined: 9/8/2003 Status: offline
|
RE: Date problem when date used as parameter in Hyperlink - 9/21/2003 18:48:30
I don't now it anymore now. I created a page where you can see what's happening http://pigeons.no-ip.info/tester30/time.Asp Just click on the different dates en see the results You'll see that 06/01/2004 is not working. I need to reformat the date before it is given to the query. Can show me how to do that. So the date that i have from the resultpage, that date is the date that i'm using in the hyperlink, i need to swap days and months before the query is send to the db. I hope that i'm not to confusing here
|
|
|
|
jorge
Posts: 31 Joined: 9/8/2003 Status: offline
|
RE: Date problem when date used as parameter in Hyperlink - 9/21/2003 20:27:51
I found it::::: fp_sQry="SELECT FORMAT(wedstrijde.Datum,'mmm-dd-yyyy')As Datum,Naam FROM wedstrijde ORDER BY Datum DESC" tx everybody
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|