Search Between Two Dates

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • arunsan3
    New Member
    • Apr 2010
    • 4

    #1

    Search Between Two Dates

    Hi Friends,
    I am having two datetimepicker control.One Date Time Picker Control I am getting From Date another dtp Control To Date i want to display between two date values in gridview.

    I try below two query's

    select * from emp where empdate<= dtp1.value and empdate>=dtp2.v alue

    select * from emp where empdate between dtp1.value and dtp2.value

    **even i used dtp1.text also.

    above both are working but i am jan 2 to jan 27 means it will displaying till dec 27.

    Problem is it is not comparing the months.It Only comparing Dates.

    Please Can you give a good solution for this.....

    Thank you.
  • Monomachus
    Recognized Expert New Member
    • Apr 2008
    • 127

    #2
    Originally posted by arunsan3
    Hi Friends,
    I am having two datetimepicker control.One Date Time Picker Control I am getting From Date another dtp Control To Date i want to display between two date values in gridview.

    I try below two query's

    select * from emp where empdate<= dtp1.value and empdate>=dtp2.v alue

    select * from emp where empdate between dtp1.value and dtp2.value

    **even i used dtp1.text also.

    above both are working but i am jan 2 to jan 27 means it will displaying till dec 27.

    Problem is it is not comparing the months.It Only comparing Dates.

    Please Can you give a good solution for this.....

    Thank you.
    Give us an example of what you need to obtain. Also see the properties of DateTime structure, think what do you really need to compare.
    DateTime Structure properties.

    Comment

    • semomaniz
      Recognized Expert New Member
      • Oct 2007
      • 210

      #3
      Please post your code and show us what you have done.

      Comment

      Working...