Rss & SiteMap
Foxtable(狐表) http://www.foxtable.com
Dim b4 As Double
Dim n As Integer = Date.Today.DayOfWeek
Dim d1 As Date = iif(n=0,Date.today.Adddays(n-6),Date.today.Adddays(1-n))
Dim d2 As Date = iif(n=0,Date.today.Adddays(n),Date.today.Adddays(7-n))
b4 = Tables("现场检查").Compute("count(审核时间)","审核时间 >= #" & d1 & "# And 审核时间 <= #" & d2 & "#")
output.show(d1)
output.show(d2)
output.show(b4)
结果为:
2012-01-09
2012-01-15
2
而表里记录为:
你的审核时间是DateLongTime的,以前有教过你怎么处理的。
Dim b1 As WinForm.Label = e.Form.Controls("Label40")
Dim b2 As WinForm.Label = e.Form.Controls("Label41")
Dim b3 As WinForm.Label = e.Form.Controls("Label17")
Dim b4 As WinForm.Label = e.Form.Controls("Label50")
Dim b5 As WinForm.Label = e.Form.Controls("Label46")
b1.Text = Tables("现场检查").Compute("count(审核状态)", "审核状态 = false and 录入时间 > #" & Today.AddDays(-1) & "#")
b2.Text = Tables("现场检查").Compute("count(审核状态)", "审核状态 = false and 录入时间 < #" & Date.Today() & "#")
b3.Text = Tables("现场检查").Compute("count(审核状态)", "审核时间 > #" & Today.AddDays(-1) & "#")
Dim n As Integer = Date.Today.DayOfWeek
Dim d1 As Date = iif(n=0,Date.today.Adddays(n-6),Date.today.Adddays(1-n))
Dim d2 As Date = iif(n=0,Date.today.Adddays(n),Date.today.Adddays(7-n))
Dim d3 As Date = New Date(Date.today.Year,Date.today.month,1)
Dim d4 As Date = New Date(Date.today.Year,Date.today.month,Date.DaysInMonth(Date.today.Year,Date.today.Month))
b4.Text = Tables("现场检查").Compute("count(审核状态)","审核时间 >= #" & d1 & "# And 审核时间 <= #" & d2 & "#")
b5.text = Tables("现场检查").Compute("count(审核状态)","审核时间 >= #" & d3 & "# And 审核时间 <= #" & d4 & "#")
表中的审核时间 和 录入时间 是yyyy-MM-DD HH:MM:SS 形式
d1,d2,d3,d4 是yyyy-MM-DD形式
下载信息 [文件大小: 下载次数: ] | |
![]() |
命令窗口代码执行一下 可以看出 本周的数据有问题
Dim b1 As Integer
Dim b2 As Integer
Dim b3 As Integer
b1 = Tables("现场检查").Compute("count(审核状态)", "审核时间 > #" & Today.AddDays(-1) & "#")
Dim n As Integer = Date.Today.DayOfWeek
Dim d1 As Date = iif(n=0,Date.today.Adddays(n-6),Date.today.Adddays(1-n))
Dim d2 As Date = iif(n=0,Date.today.Adddays(n),Date.today.Adddays(7-n))
Dim d3 As Date = New Date(Date.today.Year,Date.today.month,1)
Dim d4 As Date = New Date(Date.today.Year,Date.today.month,Date.DaysInMonth(Date.today.Year,Date.today.Month))
b2 = Tables("现场检查").Compute("count(审核状态)","审核时间 >= #" & d1 & "# And 审核时间 <= #" & d2 & "#")
b3 = Tables("现场检查").Compute("count(审核状态)","审核时间 >= #" & d3 & "# And 审核时间 <= #" & d4 & "#")
output.show(d1)
output.show(d2)
output.show(b2)
解决了 多谢大家了!