读书人

sqlDateSourse读取Calendar控件的值,该

发布时间: 2012-03-26 15:46:56 作者: rapoo

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

读书人网 >asp.net

热点推荐