If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Help please! Problem with a particular date in SQL command?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-18-05, 22:06
basquille basquille is offline
Registered User
 
Join Date: Nov 2004
Posts: 4
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:

http://homepage.eircom.net/~basquille/photoDB.mdb

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.

Brian
Reply With Quote
  #2 (permalink)  
Old 01-18-05, 23:48
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
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#
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 01-19-05, 03:26
basquille basquille is offline
Registered User
 
Join Date: Nov 2004
Posts: 4
Cheers r937.

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

Quite a bizarre problem that!

Cheers again
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On