当月人天改变时,去计算这个任务的剩余人天的代码。
因为可能涉及数据库的行,所以需要用到sql命令,没办法用表达式。下面黄色标注的时耗时比较多的代码。现在只有4行加起来差不多要等1-2秒。这样的体验感太差了。。
不知道有没有优化的方法,或者时其他思路。
此主题相关图片如下:1.jpg

e.DataRow.Save()
sum = DataTables("XMFP").SQLCompute("Sum(当月人天)","任务= '"& rw & "' and BH = '" & BH & "' ")
drs = DataTables("XMFP").SQLS\ect("任务= '" & rw & "' and BH = '" & BH & "'")
Dim sy As Double = e.DataRow("任务人天")- sum
If DRS IsNot Nothing Then
For Each dr2 As DataRow In drs
dr2("剩余人天") = sy
Next
End If
drs2 = DataTables("XMFP").SE\ect("任务= '" & rw & "' and BH = '" & BH & "'")
DataTables("XMFP").SQLUpdate(drs)
If DRS2 IsNot Nothing Then
For Each dr3 As DataRow In drs2
Dim wz As Integer= Tables("XMFP").FindRow(dr3)
If wz >= 0 Then
Tables("xmfp").Rows(WZ).Load()
End If
Next
End If
[此贴子已经被作者于2019/5/10 15:32:56编辑过]