如何让sqldatesourse的where语句能够读到calendar选定日期的年和月的值?

解决方案 »

  1.   

    select * from table where getdate() between timeStart and timeEnd
    --或者
    select * from table where getdate() >=timeStart and getdate()<=timeEnd
      

  2.   

    就是用Calendar选定日期后,在sqldatesourse控件中要用where语句根据选择日期的年和月从数据库中select出符合条件的内容。
      

  3.   

    select * from table where DATEPART(yy,Calendar1.SelectedDate)//根据年
    select * from table where DATEPART(mm,Calendar1.SelectedDate)//根据月
    貌似Calendar1.SelectedDate可以直接获取
     this.Calendar1.SelectedDate.Year 
     this.Calendar1.SelectedDate.Month