当前位置: 代码迷 >> ASP.NET >> sqlDateSourse读取Calendar控件的值,该如何解决
  详细解决方案

sqlDateSourse读取Calendar控件的值,该如何解决

热度:446   发布时间:2013-02-25 00:00:00.0
sqlDateSourse读取Calendar控件的值
如何让sqldatesourse的where语句能够读到calendar选定日期的年和月的值?

------解决方案--------------------------------------------------------
select * from table where getdate() between timeStart and timeEnd
--或者
select * from table where getdate() >=timeStart and getdate()<=timeEnd
------解决方案--------------------------------------------------------
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
  相关解决方案