Click here to Skip to main content
11,713,845 members (84,988 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# SQL ADO.NET
hi


i have two table in access I want to select values ​​based on date, now i write this code:

SELECT tblFishBank.CodeFish, tblFishBank.Mablagh, tblFishBank.SDate, tblFishBank.MDate, tblFishBank.Dis, tblProjeh.fldName, tblProjeh.fldFamil, tblFishBank.InsertDate, tblFishBank.InsertDate
FROM tblProjeh INNER JOIN tblFishBank ON tblProjeh.CodeProj = tblFishBank.CodeProj
WHERE (((tblFishBank.InsertDate)>=#8/20/2014#) AND ((tblFishBank.InsertDate)<=#8/21/2014#));


But when I run this code. No results, But when I remove this section of code:
WHERE (((tblFishBank.InsertDate)>=#8/20/2014#) AND ((tblFishBank.InsertDate)<=#8/21/2014#));


The result returned


How do I correct this code that returns a result between two dates? i use access
Posted 20-Aug-14 20:59pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

I would guess your parameter value is not in the right datetime format.
try replacing with:

WHERE tblFishBank.InsertDate between '20140820' and '20140822'
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Try this
WHERE (((tblFishBank.InsertDate)>='8/20/2014') AND ((tblFishBank.InsertDate)<='8/21/2014'));
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

tanks for all

i try this and work

WHERE (((tblFishBank.InsertDate)>#8/20/2014#) AND ((tblFishBank.InsertDate)< #8/22/2014#));

i replacing >= with > and date 8/21/2014 to 8/22/2014 i added one day to date
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 370
1 CHill60 250
2 Maciej Los 229
3 Richard MacCutchan 210
4 OriginalGriff 175
0 Sergey Alexandrovich Kryukov 365
1 CHill60 335
2 OriginalGriff 245
3 Andy Lanng 173
4 Richard MacCutchan 150


Advertise | Privacy | Mobile
Web03 | 2.8.150819.1 | Last Updated 21 Aug 2014
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100