以文本方式查看主题

-  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=97404)

--  作者:yyzlxc
--  发布时间:2017/3/11 16:47:00
--  [求助]新增行无法填充数据
用QueryBuilder生成的查询表”名册",下面代码的目的是:从“bzkh”表查找符合条件、而"名册"表中不含的bh值。如果找到的话,在"名册"表增加一行,并将找到的bh值填入新增行的bh列。代码运行发现,可以增加行,但是却无法填入bh值,不知何故,请各位老师指教,谢谢!!



For Each dr1 As DataRow In DataTables("bzkh").DataRows
    If dr1.IsNull("bh") = False Then
        If dr1("qdb2") = db And dr1("pzrq") >= yc1 And dr1("pzrq") <= yd1 Then \'
            Dim pr As DataRow = DataTables("名册").Find("bh = \'" & dr1("bh") & "\'")
            If pr Is Nothing Then \'没有此编号
                Dim dr2 As Row = Tables("名册").AddNew()
                dr2("bh") = dr1("bh")
            End If
        End If
    End If
Next

--  作者:有点蓝
--  发布时间:2017/3/11 17:03:00
--  

贴出完整代码

 

不过查询表虽然可以改数据,不过是不能保存的