Foxtable(狐表)用户栏目专家坐堂 → [求助]优化代码速度


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

主题:[求助]优化代码速度

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


加好友 发短信
等级:三尾狐 帖子:655 积分:7689 威望:0 精华:0 注册:2013/12/11 17:49:00
[求助]优化代码速度  发帖心情 Post By:2014/11/4 14:11:00 [只看该作者]

以下代码能正常执行,但就是速度太慢,如果有200条数据的话要执行好几分钟,请教老师,帮我优化一下      

  For Each dr As DataRow In DataTables("表D").Datarows   
            For Each dc As DataCol In DataTables("表D").DataCols
                Dim gx As String
                gx=dc.name
                
                If gx <>"姓名" And gx <>"单据编号" And gx <> "员工编号" And  gx <> "生产任务单号" Then
                    If dr(gx) > 0 And dr("姓名") <> "可申报最大数量" Then
                        dr(gx) = math.Floor( dr(gx) * 10000) / 10000 '取小数位前四位
                        Dim dr1 As DataRow = DataTables("工资明细表").Addnew
                        dr1("生产任务单号") = scrwdh.Value
                        dr1("单据编号") = dr("单据编号")
                        dr1("员工编号") = dr("员工编号")
                        dr1("工序名称") = gx
                        dr1("数量") = dr(gx)
                        dr1("销售订单号") = xsddh.Value
                        dr1("产品名称") = cpmc.Value
                        dr1("工资日期") = gzrq.Value
                        dr1("单据类型") = djlx.Value
                        dr1("工资所属车间") = cjmc.Value
                        dr1("制单时间") = zdsj.Value 
                    End If
                End If
            Next
        Next


 回到顶部
总数 19 1 2 下一页