Delphi (intermediate-level only)Hi all,
The solution is simple: 
Do not use the date directly in SQL query but use Parameter instead.
Example: one want to search for students exam after 4-July-2006 so instead of:
    select * from table where exam_date > '7/4/2006'
one use the query:
   select * from table where exam_date > :exam_date
and set the appropriate parameters before execution of the query:
   qrySQL.ParaByName('exam_date').Value:=date

In this way, Delphi is in the position to convert date-time of various format 
(according to local setting of the OS) into SQL date format so that the 
programmer does not need to worry about the date time format any more. In my 
personal opinion this way of handling of search-criterions is much superior as 
coding the parameter in code yourself because beside the performance advantage 
using Query-Parameter help to prevent the SQL Injection-Attack, too. I always 
used date time (and not only date time!) in this way in all my projects and 
have no problem at all.

Happy coding,

Vo Viet Anh


----- Original Message ----- 
  From: [email protected] 
  To: [email protected] 
  Sent: Sunday, 16 July, 2006 23:05
  Subject: [delphi-en] Digest Number 1808


  Delphi (intermediate-level only) 
  Messages In This Digest (2 Messages) 
    1a. Re: Delphi SQL Date format change From: [EMAIL PROTECTED] 
    1b. Re: Delphi SQL Date format change From: Glen Thompson 
  View All Topics | Create New Topic Messages 
    1a. Re: Delphi SQL Date format change 
    Posted by: "[EMAIL PROTECTED]" [EMAIL PROTECTED] 
    Sat Jul 15, 2006 9:43 pm (PST) 
    Hi,
    I think, the date format in SQL is not changable. it is always MM/DD/YYYY.

    Have fun
    Bob

    > Thanks a lot for your help
    > 
    > > Hi all who can help me please?In query of Delphi the default date 
format is
    > > MM/DD/YY and when I want to search by date I have to
    > > put MM/DD/YY, how can I change the format,that the
    > > user can search it like DD/MM/YY?
    > > 
    > > My Db is paradox signing with BDE (I have changed the BDE date config 
    > > but no changes)
    > > 
    > > Please help me with this if someone can.
    > > 
    > > Thank You a lot
    > > 
    > > 


    Back to top Reply to sender | Reply to group | Reply via web post 
    Messages in this topic (6) 
    1b. Re: Delphi SQL Date format change 
    Posted by: "Glen Thompson" [EMAIL PROTECTED]   gthomps5y 
    Sat Jul 15, 2006 11:03 pm (PST) 
    I agree. It seems unfortunate, but remember that SQL is just plain text
    being sent to the database engine. Access etc do something similar. Some
    databases provide functions, e.g. Oracle's TO_DATE, but they are usually
    either limited or perform poorly. Construct the text string yourself in
    code.
    Glen
    -----Original Message-----
    From: [email protected] [mailto:[EMAIL PROTECTED] Behalf
    Of [EMAIL PROTECTED]
    Sent: Sunday, 16 July 2006 2:08 PM
    To: [email protected]
    Subject: Re: [delphi-en] Delphi SQL Date format change

    Hi,
    I think, the date format in SQL is not changable. it is always MM/DD/YYYY.

    Have fun
    Bob

    > Thanks a lot for your help
    >
    > > Hi all who can help me please?In query of Delphi the default date format
    is
    > > MM/DD/YY and when I want to search by date I have to
    > > put MM/DD/YY, how can I change the format,that the
    > > user can search it like DD/MM/YY?
    > >
    > > My Db is paradox signing with BDE (I have changed the BDE date config
    > > but no changes)
    > >
    > > Please help me with this if someone can.
    > >
    > > Thank You a lot
    > >
    > >

    [Non-text portions of this message have been removed]


    Back to top Reply to sender | Reply to group | Reply via web post 
    Messages in this topic (6) New Message Search
  Find the message you want faster. Visit your group to try out the improved 
message search.



  Share feedback on the new changes to Groups

  Recent Activity
    a..  9 New Members
  Visit Your Group 
  SPONSORED LINKS
    a.. C programming language 
    b.. Computer programming languages 
    c.. Java programming language 
    d.. The c programming language 
    e.. C programming language 
    f.. Concept of programming language 
  Need to Reply?
  Click one of the "Reply" links to respond to a specific message in the Daily 
Digest.
  Create New Topic | Visit Your Group on the Web 
  Messages 
  -----------------------------------------------------
  Home page: http://groups.yahoo.com/group/delphi-en/
  To unsubscribe: [EMAIL PROTECTED] 
   
  You are receiving a Daily Digest Change Delivery Settings 
  Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe 
   

[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Yahoo! Groups gets a make over. See the new email design.
http://us.click.yahoo.com/XISQkA/lOaOAA/yQLSAA/i7folB/TM
--------------------------------------------------------------------~-> 

-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/delphi-en/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to