6 messages in com.mysql.lists.win32Re: MS ASP Date Problem with MyODBC d...| From | Sent On | Attachments |
|---|---|---|
| Dennis Salguero | 21 Mar 2001 06:24 | |
| PeterWR | 21 Mar 2001 06:35 | |
| Julian Strickland | 21 Mar 2001 06:47 | |
| Guillaume | 21 Mar 2001 07:11 | |
| webm...@w3space.com | 21 Mar 2001 09:26 | |
| Neil Gamon | 21 Mar 2001 23:32 |
| Subject: | Re: MS ASP Date Problem with MyODBC driver![]() |
|---|---|
| From: | webm...@w3space.com (webm...@w3space.com) |
| Date: | 03/21/2001 09:26:32 AM |
| List: | com.mysql.lists.win32 |
Hi
you should check Session.LCID and Session.CodePage...
Another way is ... manual formatting :
varEndDate =
year(request("enddate"))&"-"&month(request("enddate"))&"-"&day(request("enddate"))
or the use of a function (as this issue comes back often in a project)
Hope this helps ///// D W A M W 3 S P A C E ///////////////////// Guillaume de Lafontaine - webm...@w3space.com . Services Internet : http://www.w3space.com . Annuaire Aquitaine : http://www.aquitanet.com . Espace TeleTravail : http://www.w3workers.com . DWAM.NT Docs & Resources : http://www.dwam.net
-----Message d'origine----- De : Neil Gamon <NEI...@bigpond.com> À : win...@lists.mysql.com <win...@lists.mysql.com> Date : mercredi 21 mars 2001 15:09 Objet : MS ASP Date Problem with MyODBC driver
|Dear Members Volunteer, problem getting an Microsoft ASP script SQL command |executed, which compares a database field of DateTime type with a variable |which contains a DateTime, if I compare the database field DateTime with the |Now() Function, the SQL result is OK. How can I get this compare to work |using a variable, as the variable contains a date which comes from a form |that is submitted, the database is MySQL using MyODBC. | |Here is the code that does NOT work using variable varEndDate using MyODBC & |MySQL: | |varEndDate = request("enddate") 'from submit form contains date |Set Con = Server.CreateObject( "ADODB.Connection" ) |Con.Open "db" |set Cmd = Server.CreateObject("ADODB.Command") | Cmd.ActiveConnection = Con | Cmd.CommandType = 1 | Cmd.CommandText = "SELECT NameOfOrderer, DeliveryName, " &_ | "FROM orderheader " &_ | "WHERE (orderheader.DocketDate < " & varEndDate & ")" ERROR HERE | getOrderID.Open Cmd | | |Here is the code that works using the Now() Function using MyODBC & MySQL: | |varEndDate = request("enddate") |Set Con = Server.CreateObject( "ADODB.Connection" ) |Con.Open "db" |set Cmd = Server.CreateObject("ADODB.Command") | Cmd.ActiveConnection = Con | Cmd.CommandType = 1 | Cmd.CommandText = "SELECT NameOfOrderer, DeliveryName, " &_ | "FROM orderheader " &_ | "WHERE (orderheader.DocketDate < Now())" WORKS OK | getOrderID.Open Cmd | | |Here is code that works using CDate function to a Access Database, all OK. | |varEndDate = request("enddate") |Set Con = Server.CreateObject( "ADODB.Connection" ) |Con.Open "db" |set Cmd = Server.CreateObject("ADODB.Command") | Cmd.ActiveConnection = Con | Cmd.CommandType = 1 | Cmd.CommandText = "SELECT NameOfOrderer, DeliveryName, " &_ | "FROM orderheader " &_ | "WHERE (orderheader.DocketDate < CDate('" & varEndDate & "'))" WORKS |OK | getOrderID.Open Cmd | |Have tryed combinations of CDate, FormatDateTime functions to set variable |EndDate of type DateTime, have also altered database field to type Date with |no time, but still the SQL errors when using MyODBC & MySQL. The Now() |Function work OK, but not the variable? The last example using CDate |function to a Access database works OK, but doing this to MySQL database |causes a error. The MyODBC driver will not accept the CDate function like |the Access driver does. The MyODBC driver excepts the Now() function as a |datetime object and SQL statment executes OK. So how can we get the MyODBC |driver to except a variable of datetime submitted from the previous form?. |It seems ASP runs well with Microsoft databases, but can present some |unsolvable problems with others, such as MySQL. |Can you help please. |Reply to |nei...@bigpond.com | | | |--------------------------------------------------------------------- |Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before |posting. To request this thread, e-mail win3...@lists.mysql.com | |To unsubscribe, send a message to the address shown in the |List-Unsubscribe header of this message. If you cannot see it, |e-mail win3...@lists.mysql.com instead.




