Foxtable(狐表)用户栏目专家坐堂 → [求助] 优先下载速度


  共有5567人关注过本帖树形打印复制链接

主题:[求助] 优先下载速度

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


加好友 发短信
等级:三尾狐 帖子:799 积分:5921 威望:0 精华:0 注册:2018/11/3 8:24:00
[求助] 优先下载速度  发帖心情 Post By:2022/7/9 21:35:00 [显示全部帖子]

老师,以下这个BOM有几百万行,用以下代码太慢了,如何用Dim sql As String 来实现 ? 是不是会更快些 ?谢谢。



Dim cmd As New SQLCommand
Dim dt As DataTable
DataTables("BOM").datarows.clear
DataTables("BOM").save

cmd.C
Dim Cols1() As String = {"BomId","SortSeq","ComponentId","BaseQtyN","BaseQtyD","ParentId","Version","cInvName","VersionDesc","cInvCode"}
Dim Cols2() As String = {"BomId","SortSeq","ComponentId","BaseQtyN","BaseQtyD","ParentId","Version","cInvName","VersionDesc","cInvCode"}

cmd.CommandText ="Sel ect {bom_opcomponent}.BomId,SortSeq,ComponentId,BaseQtyN,BaseQtyD,ParentId,Version,cInvName,VersionDesc,cInvCode From (((({bom_opcomponent} Left JOIN {bom_parent} ON {bom_parent}.[BomId] = {bom_opcomponent}.[BomId]) Left JOIN {bom_bom} ON {bom_bom}.[BomId] = {bom_opcomponent}.[BomId]) Inner JOIN {bas_part} ON {bas_part}.[PartId] = {bom_opcomponent}.[ComponentId]) Inner JOIN {Inventory} ON {Inventory}.[cInvCode] = {bas_part}.[InvCode]) Where Status <> 4"

dt = cmd.ExecuteReader()
For Each dr1 As DataRow In dt.DataRows
    Dim dr2 As DataRow = DataTables("BOm").AddNew()
    For i As Integer = 0 To Cols1.Length -1
        dr2(Cols2(i)) = dr1(Cols1(i))
         Next
Next

Tables("BOM").ResumeRedraw()

 回到顶部