Foxtable(狐表)用户栏目专家坐堂 → 请问下面的代码运行为何慢?


  共有1336人关注过本帖平板打印复制链接

主题:请问下面的代码运行为何慢?

帅哥哟,离线,有人找我吗?
hbhb
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:狐神 帖子:5054 积分:13031 威望:0 精华:0 注册:2014/5/15 21:34:00
请问下面的代码运行为何慢?  发帖心情 Post By:2017/2/23 11:33:00 [只看该作者]

 大师:请问下面的代码如何优化,总共才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


 回到顶部