老师你好,以下代码执行正确,但速度有点慢,总觉得可以优化一下,但不知道怎么优化。请老师指教为感!Dim st As Date = Date.Now()
Dim drs As List(of DataRow) = DataTables("窗口1_Table7").Select("应付款余额 > 0 and 类别 = '收piao' and 付款到期日期 <= '" & Date.Today & "'", "支出合同编号,付款到期日期")
For i As Integer = 0 To drs.Count - 1
Dim zcje As Decimal '定义支出合计数
Dim zccqkp As Decimal '定义超期开piao数
zcje = DataTables("窗口1_Table7").SQLCompute("Sum(金额)","支出合同编号 = '" & drs(i)("支出合同编号") & "'And [类别] = '支出'")
zccqkp = DataTables("窗口1_Table7").Compute("Sum(金额)","支出合同编号 = '" & drs(i)("支出合同编号") & "'And [类别] = '收piao' And 付款到期日期 <= '" & drs(i)("付款到期日期") & "'")
If zcje < zccqkp Then
drs(i)("付款是否超期") = "已超期"
Else
drs(i)("付款是否超期") = Nothing
End If
Next
DataTables("窗口1_Table7").Save()
MessageBox.Show("执行时间:" & (Date.Now - st).TotalSeconds)