大师:请问下面的代码如何优化,总共才50行遍列,为何要5秒钟才运行完?
Dim cm---d As Ne--w S-Q-L-Command
Dim dt As DataTable
cmd.Con---necti
cmd.Comm---andText = "SE-------LECT * From {zsjbsjcj} where zzzz2 = '表1'"
dt = cm----d.----ExecuteReader()
Dim tbkj As WinForm.Table = e.Form.Controls("Table1")
Dim tb As Table
tb = tbkj.Table
tb.DataTable.StopRedraw
For Each r As DataRow In tb.DataTable.dataRows
If r.IsNull("zcfzb1") = False Then
r("zcfzb27") = dt.Compute("min(zzzz32)","zzzz4 = '" & trim(r("zcfzb1")) & "' and zzzz5 is null")
r("zcfzb9") = dt.Compute("min(zzzz21)","zzzz4 = '" & trim(r("zcfzb1")) & "' and zzzz5 is null")
End If
If r.IsNull("zcfzb5") = False Then
r("zcfzb28") = dt.Compute("min(zzzz32)","zzzz4 = '" & trim(r("zcfzb5")) & "' and zzzz5 is null")
r("zcfzb18") = dt.Compute("min(zzzz21)","zzzz4 = '" & trim(r("zcfzb5")) & "' and zzzz5 is null")
End If
Next
tb.DataTable.ResumeRedraw