[DUG] firebird query parameters behaving oddly
Cheng Wei (FMI)
chengw at fmi.co.nz
Tue Jul 10 13:59:45 NZST 2007
Hi Tracey,
I've been able to retrieve desired results reliably in both IB and FB,
the key to it is:
1). Using Month Abbreviations instead of numeric values
2). Using hyphen as date separator instead of forward slash
i.e: Try convert your date string from "10/11/2007" to "10-nov-2007"
Cheers
Cheng Wei
Software Development Manager
FMI Research Ltd
P: +64 9 984 4917
F: +64 9 984 4993
M: +64 21 410 776
E: chengw at fmi.co.nz
W: http://www.fmi.co.nz
|-----Original Message-----
|From: delphi-bounces at delphi.org.nz
|[mailto:delphi-bounces at delphi.org.nz] On Behalf Of Tracey
|Sent: Tuesday, 10 July 2007 1:28 p.m.
|To: 'NZ Borland Developers Group - Delphi List'
|Subject: RE: [DUG] firebird query parameters behaving oddly
|
|Well the problem is that the date is being fed into Firebird
|as "10/11/2007"
|but firebird is reading it as "11/10/2007"
|
|Even constructing the dates as you suggest does not help.
|
|:(
|
|Anyone here ever struck these bazaar locale errors where I
|only have the one locale on my machine, (US locale removed at
|install) and yet I am having these US date problems (same
|problem within SQL Server). I have strolled through the
|registry and the only items with language set to US are:
|
|my graphics card (where userlanguage is set to Eng(nz) anyway),
|
|My dotnet compact frameworks,
|
|HKEY_LOCAL_MACHINE\SOFTWARE\ITConcepts\onecard SETUPLANGUAGE,
|whatever that is (possibly my credentials management or something),
|
|HKEY_
|USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\ThemeManager
|LASTUSERLANGUAGEID
|And
|HKey_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\The
meManager
|LASTUSERLANGUAGEID
|
|ARRGGGHHHHHHH
|
|
|-----Original Message-----
|From: delphi-bounces at delphi.org.nz
|[mailto:delphi-bounces at delphi.org.nz] On Behalf Of Steve Peacocke
|Sent: Tuesday, 10 July 2007 12:50 p.m.
|To: NZ Borland Developers Group - Delphi List
|Subject: Re: [DUG] firebird query parameters behaving oddly
|
|On 10/07/07, Tracey <tracey at logis.co.nz> wrote:
|> Difficult.
|>
|> I use a javascript calendar picker to populate dates formatted
|> dd/MM/yyyy (user requirements) which is passed via
|"textbox.value" to
|> a javascript function which in turn passes the value
|directly back to my Delphi app.
|>
|
|Good Afternoon Tracey,
|
|Could you use EncodeDate(), which will ensure that you are
|passing the actual date as you would like. E.g. ...
|
|// sDate = your date string = dd/mm/yyyy = '10/07/2007'
|// d, m, y : Word;
|Try
| d := StrToInt(copy(sDate, 1, 2));
| m := StrToInt(copy(sDate, 4, 2));
| y := StrToInt(copy(sDate, 7, 4));
| MyDate := EncodeDate(y, m, d);
|except
| ShowMessage('Not a date');
|end;
|
|Steve
|--
|Steve Peacocke
|http://stevepeacocke.blogspot.com/
|_______________________________________________
|NZ Borland Developers Group - Delphi mailing list
|Post: delphi at delphi.org.nz
|Admin: http://delphi.org.nz/mailman/listinfo/delphi
|Unsubscribe: send an email to delphi-request at delphi.org.nz
|with Subject:
|unsubscribe
|
|
|_______________________________________________
|NZ Borland Developers Group - Delphi mailing list
|Post: delphi at delphi.org.nz
|Admin: http://delphi.org.nz/mailman/listinfo/delphi
|Unsubscribe: send an email to delphi-request at delphi.org.nz
|with Subject: unsubscribe
|
More information about the Delphi
mailing list