= adCmdText
Adodc1.RecordSource = "select * from bwl order by 时间 asc"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveLast
Label1.Caption = Adodc1.Recordset.Fields("时间")
样可以查最大值,但是在某一段时间内怎么查?
= adCmdText
Adodc1.RecordSource = "select max(时间) as 最大时间 from bwl where 时间>=#20:00:00# and 时间<=#20:59:59#"
If Adodc1.Recordset.RecordCount > 0 Then
Label1.Caption = Adodc1.Recordset.Fields("最大时间")
end if
版主!你的方法要在已知“最大时间”情况下才有用,我是想先查询这个时间段,然后提取这个时间段中的最大时间:
比如:
20:00:01
20:00:03
20:00:06
20:00:09
20:00:12
我要的结果是提取出20:00:12
我是这样弄了下!好像可行:
Me. = adCmdText
Me.Adodc1.RecordSource = "select * from bwl where 时间>=#20:00:00# and 时间<=#20:59:59# order by 时间 asc"
Me.Adodc1.Refresh
If Me.Adodc1.Recordset.RecordCount > 0 Then
Me.Adodc1.Recordset.MoveLast
Me.Label1.Caption = Me.Adodc1.Recordset.Fields("时间")
End If