Subject | Re: [IBO] Date format issue |
---|---|
Author | Svein Erling Tysvær |
Post date | 2001-02-14T08:05:36Z |
At 14:54 14.02.2001 +1300, Johannes wrote:
application programmer, system administrator or anyone who writes SQL could
be forced to use a particular format - at least in my opinion.
I'd say your missing something, and not blame Interbase ;=) You're correct
in that you cannot write something like
IB_Query1.SQL:='SELECT * FROM TABLE1 WHERE SOMEDATE = '+Edit1.Text;
for any date format, but
IB_Query1.SQL:='SELECT * FROM TABLE1 WHERE SOMEDATE = :SOMEDATE';
IB_Query1.Prepare;
IB_Query1.ParamByName('SomeDate').AsDate:=strtodate(Edit1.Text);
or
IB_Query1.SQL:='SELECT * FROM TABLE1 WHERE SOMEDATE =
'+strtodate(Edit1.Text);
should work if your Date settings are properly defined in your Control
Panel. Thus, it should be no problem to avoid any date format issues for
your end users (that is, unless you allow them to type the entire SQL
string themselves).
HTH,
Set
>Only dmy, mdy, ymd works for stored procedures, and worse only mdy, ymdWell, the end user should be able to pick any format he/she wants. The
>works for queries and cursors. That's no good. The user should be able
>to pick any format they want!
application programmer, system administrator or anyone who writes SQL could
be forced to use a particular format - at least in my opinion.
>This looks to me as though there is some filtering being done hereOnce again I have to disagree with Helen (that's twice in about one week).
>implying restrictions as to what date format the user can select unless
>the application performs an expensive date format analysis to provide in
>turn the restricted date format for queries.
>
>What's wrong here?
>Who is it?
>Interbase or IBO?
>Am I missing something?
I'd say your missing something, and not blame Interbase ;=) You're correct
in that you cannot write something like
IB_Query1.SQL:='SELECT * FROM TABLE1 WHERE SOMEDATE = '+Edit1.Text;
for any date format, but
IB_Query1.SQL:='SELECT * FROM TABLE1 WHERE SOMEDATE = :SOMEDATE';
IB_Query1.Prepare;
IB_Query1.ParamByName('SomeDate').AsDate:=strtodate(Edit1.Text);
or
IB_Query1.SQL:='SELECT * FROM TABLE1 WHERE SOMEDATE =
'+strtodate(Edit1.Text);
should work if your Date settings are properly defined in your Control
Panel. Thus, it should be no problem to avoid any date format issues for
your end users (that is, unless you allow them to type the entire SQL
string themselves).
HTH,
Set