Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2004

    Unanswered: Help please! Problem with a particular date in SQL command?

    Hello all.

    A very irritating problem i am having right now. I'm writing a Photo Album in C# using OleDb connection.

    Everything else in the program is working fine. Except one element of searching:

    One of the searches i can do is to find all photos for a particular date.

    Best to look at my Database to understand more:

    But basically the user enters in a date and i've incorporated it to run as an SQL statement.

    The bizarre thing is: i can search the database providing a date (and
    display the results) most of the time successfully with no problems. There's
    only 15 entries in 'photo' table - it has a couple of entries for the date
    10/01/2000. But when i try and find these, i get nothing back... why would
    this be?

    To test it out yourself... look at some of the dates (phDate) in the 'photo' table. Try some SQL queries to return information based on a chosen date.

    Now try:
    Select * from photos where phDate = #10/01/2000#

    Very bizarre!

    Any feedback or suggestions would be much appreciated.


  2. #2
    Join Date
    Apr 2002
    Toronto, Canada
    without being able to see your data, i can only guess

    1) october 1st or january 10th?

    try both of these --

    ... where phDate = #2000-10-01#

    ... where phDate = #2000-01-10#

    2) time component

    try both of these --

    ... where format(phDate,"yyyy-mm-dd") = #2000-10-01#

    ... where format(phDate,"yyyy-mm-dd") = #2000-01-10# | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Nov 2004
    Cheers r937.

    Got it with: 'Select * from photos where phDate = #2000/01/10#'

    Quite a bizarre problem that!

    Cheers again

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts