以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助] 代码执行没有反应  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=152333)

--  作者:susanhe
--  发布时间:2020/7/10 7:55:00
--  [求助] 代码执行没有反应

老师,以下代码有问题吗 ? 为什么执行时没有反应? 死机了 ?

For Each dr1aa As DataRow In DataTables("TEST2").SQLSe lect("[FEntrySelfZ0142] is null")
    Dim cmd As new SQLCommand
    cmd.C
    Dim dt As DataTable
    cmd.CommandText = "Se lect * From {TEST3}"
    dt = cmd.ExecuteReader(True)
   
    Dim fdr As DataRow = dt.find("FInterID =\'" & dr1aa("FInterID") & "\'")
   
    If fdr  Is Nothing Then
        dr1aa("FEntrySelfZ0142") = fdr("FItemID")
    End If
    dt.Save()
Next

msgbox("done")

--  作者:有点蓝
--  发布时间:2020/7/10 9:26:00
--  
语法上没有问题,逻辑上有致命的问题,每循环一次就加载一次TEST3不卡死才怪

Dim cmd As new SQLCommand
    cmd.C
    Dim dt As DataTable
    cmd.CommandText = "Se lect * From {TEST3}"
    dt = cmd.ExecuteReader()
Dim fdr As DataRow
dim drs as list(of datarow) = DataTables("TEST2").SQLSe lect("[FEntrySelfZ0142] is null")
For Each dr1aa As DataRow In drs
    fdr = dt.find("FInterID =\'" & dr1aa("FInterID") & "\'")
    If fdr  Isnot Nothing Then
        dr1aa("FEntrySelfZ0142") = fdr("FItemID")
    End If
Next
DataTables("TEST2").SQLupdate(drs)