st
As Date
= Date.Now
'要测试耗时的代码
MessageBox.Show("耗时:
" & (Date.Now
- st).TotalSeconds & "秒")
例如:
Dim
st
As Date
= Date.Now
'将开始时间保存在变量st中
Dim nms
As List(of
String)
= DataTables("表A").GetValues("客户")
DataTables("表B").StopRedraw()
For Each nm
As String
In nms
Dim dr
As DataRow
= DataTables("表B").AddNew()
dr("客户")
= nm
dr("付款合计")
= DataTables("表A").Compute("Sum(金额)",
"客户 = '"
&
nm &
"' And tk = 1")
dr("欠款合计")
= DataTables("表A").Compute("Sum(金额)",
"客户 = '"
&
nm &
"' And tk = 0")
Next
DataTables("表B").ResumeRedraw()
MessageBox.Show("耗时: "
& (Date.Now
- st).TotalSeconds & "秒") '计算并显示执行代码所花费的秒数
本页地址:http://www.foxtable.com/webhelp/topics/2226.htm