dcsimg
Results 1 to 9 of 9

Thread: between dates and times

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2011
    Posts
    7

    Thumbs up between dates and times

    hello
    i want to use data grid to view all data in table of access database .
    that table include field name date and other one name Time
    i want to range between 2dates and 2 times when i query from database to datagridview

    thanks

  2. #2
    PowerPoster kaliman79912's Avatar
    Join Date
    Jan 2009
    Location
    Ciudad Juarez, Chihuahua. Mexico
    Posts
    2,593

    Re: between dates and times

    And what is your question?
    More important than the will to succeed, is the will to prepare for success.

    Please rate the posts, your comments are the fuel to keep helping people

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2011
    Posts
    7

    Re: between dates and times

    how to do it ?

    i want to range between 2dates and 2 times when i query from database to datagridview

  4. #4
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    102,896

    Re: between dates and times

    Follow the Blog link in my signature and check out my post on Parameters In ADO.NET. You would just need to provide two DateTimePickers for the user to enter the limits and use two conditions in your WHERE clause.

  5. #5

    Thread Starter
    New Member
    Join Date
    Mar 2011
    Posts
    7

    Re: between dates and times

    i can make it works between dates but also add between times is not working here many try's

    why always all reply need confirm from admin that make it too slow here

  6. #6
    Hyperactive Member mbutler755's Avatar
    Join Date
    May 2008
    Location
    Peoria, AZ
    Posts
    417

    Re: between dates and times

    You can expand a DateTime Picker to include times as well. Then, use the two where statements that jmc suggested to make it work.
    Regards,

    Matt Butler, MBA, BSIT/SE, MCBP
    Owner, Intense IT, LLC
    Find us on Facebook
    Follow us on Twitter
    Link up on LinkedIn
    mb (at) i2t.us

    CODE BANK SUBMISSIONS: Converting Images to Base64 and Back Again

  7. #7
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    102,896

    Re: between dates and times

    Quote Originally Posted by el3ashe2 View Post
    i can make it works between dates but also add between times is not working here many try's
    Firstly, it's a bad idea to have the date and time in separate columns if they actually represent one value. If they represent a point in time together then they should be stored as a single value, even if they get displayed separately in your UI.

    That said, it will still work if you do it correctly. You can use one DateTimePicker for both or you can use one for date and one for time. You simply configure the properties of the control to display what you want. You then get a DateTime from the Value property of the DateTimePicker. If you want just the date portion of that DateTime then you get its Date property, which returns another DateTime with the time portion zeroed. If you want just the time portion then you get its TimeOfDay property, which returns a TimeSpan.
    Quote Originally Posted by el3ashe2 View Post
    why always all reply need confirm from admin that make it too slow here
    All new members must have their posts moderated to prevent garbage and spam. Once you are considered trustworthy, which is after about 10 posts I believe, then your posts will appear immediately. It's all in the FAQ for those who care to look.

  8. #8

    Thread Starter
    New Member
    Join Date
    Mar 2011
    Posts
    7

    Re: between dates and times

    yes i try that but i was rush and want to finish it
    and after i found that forum too slow because confirm every reply of mine
    i try many times and finally did it
    but thank you any way for support me
    and i want you explain more about this value because i did it before long time ago and i fail to remember how i did that

  9. #9
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,142

    Re: between dates and times

    Quote Originally Posted by el3ashe2 View Post
    and after i found that forum too slow because confirm every reply of mine
    It is annoying, but unfortunately it is necessary... for each valid person who gets slowed down a bit, there are about 5 spammers who get stopped completely (and some of them post 30+ threads at a time).

    There is no way for us to mark you as a valid person (apart from approving your posts), so I'm afraid you'll have to put up with the delay until the system considers you to be valid... which shouldn't be much longer.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width