Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共2 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:更新数据问题

1楼
lrh9537 发表于:2025/1/24 16:37:00
Dim Cols1() As String = {"乡镇", "行政村", "总计"}
Dim Cols2() As String = {"乡镇", "行政村", "总计"}
For Each dr1 As DataRow In DataTables("分村统计表").Select("[乡镇] IS NOT NULL")
    Dim dr2 As DataRow = DataTables("分村统计表2").AddNew()
    For i As Integer = 0 To Cols1.Length - 1
        dr2(Cols2(i)) = dr1(Cols1(i))
    Next
Next

修改为:如“分村统计表2”中已存在“乡镇", "行政村", "总计”,保持分村统计表2”中的“乡镇", "行政村"不变也不新增,只更新表中的其他数据 
2楼
有点蓝 发表于:2025/1/24 16:50:00
先使用find查询一下,没有再新增:http://www.foxtable.com/webhelp/topics/0396.htm

……
For Each dr1 As DataRow In DataTables("分村统计表").Select("[乡镇] IS NOT NULL")
Dim dr2 As DataRow = DataTables("分村统计表2").find(“乡镇='" & dr1("乡镇") & "' and 行政村='" & dr1("行政村") & "')
if dr2 is nothing then dr2  = DataTables("分村统计表2").AddNew()
    For i As Integer = 0 To Cols1.Length - 1
        dr2(Cols2(i)) = dr1(Cols1(i))
    Next
……
共2 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .05371 s, 2 queries.