前几天写碰到了这个问题,就是获取表中某一时间段的数据,觉得monthview这个控件很适合。
'获取点击的时间传给combbegin
'获取点击的时间传给combbegin
Private Sub ViewBegin_DateClick(ByVal DateClicked As Date)
Dim byear As Integer
Dim bmonth As Integer
Dim bday As Integer
byear = ViewBegin.Year
bmonth = ViewBegin.Month
bday = ViewBegin.Day
combbegin.Text = DateSerial(byear, bmonth, bday)
ViewBegin.Visible = False
End Sub
’获取另外一个时间传给combend
Private Sub ViewEnd_DateClick(ByVal DateClicked As Date)
Dim eday As Integer
Dim eyear As Integer
Dim emonth As Integer
eday = ViewEnd.Day
emonth = ViewEnd.Month
eyear = ViewEnd.Year
combEnd.Text = DateSerial(eyear, emonth, eday)
ViewEnd.Visible = False
End Sub
select语句
select * from recharge_info where date > '" & combbegin.Text & "'" & "and" & " date < '" & combEnd.Text & "'