Results 1 to 2 of 2
  1. #1
    udigold1 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2010
    Posts
    29

    Query problem with c#

    Hi,

    I have a c# form in which I retrieve data from Access DB.
    I have Two DateTimePickers so I could choose data between dates.
    My problems is when I try to retreive data between 19/10/2010 and 12/12/2010 it gives me me data beyond 12/12/2010 but when I try to retreive data between 9/12/2010 and 12/12/2010 it works fine.

    here's my query:
    C# Syntax (Toggle Plain Text)


    1. "select DateId, NiarDesc, ManagerId, RateText, QuantityVal, ActionID From tbl1_order
    2. where DateValue(DateId) between "'19/10/2010' and '12/12/2010'";



    i also tried to do it with getting the dates form the datetimepicker:

    C# Syntax (Toggle Plain Text)


    1. "select DateId, NiarDesc, ManagerId, RateText, QuantityVal, ActionID From tbl1_order
    2. where DateValue(DateId) between "' + datepicker1.Value.ToShortDateString + '" +
    3. " and '" + datePicker2.Value.ToShortDateString +"'"


    It seems that it ignores the month value and considers only the day value.
    Why this is happening?



    Thanks,
    Udi

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,923
    See if this link helps a bit: http://allenbrowne.com/ser-36.html
    (RG for short) aka Allan Bunch Previous MS Access MVP - WinXP Pro, Win7 Pro Win10 Pro - acXP, ac07, ac10, ac13
    How to mark the thread as Solved!
    Teaching is not filling a bucket but lighting a fire.
    Borrowed quote..."Docendo discimus"

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Query Problem
    By Swinton in forum Queries
    Replies: 1
    Last Post: 10-27-2010, 09:47 PM
  2. Query problem
    By puppychew in forum Access
    Replies: 20
    Last Post: 02-01-2010, 09:43 AM
  3. query problem i have a problem wi
    By maxx3 in forum Queries
    Replies: 0
    Last Post: 06-29-2009, 02:29 AM
  4. query problem
    By bhushan98 in forum Queries
    Replies: 1
    Last Post: 06-03-2009, 01:49 PM
  5. problem with query
    By kiethb in forum Queries
    Replies: 3
    Last Post: 04-24-2009, 11:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums