以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 复制如何跳过重复值 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=103648) |
-- 作者:zoyong -- 发布时间:2017/7/13 14:10:00 -- 复制如何跳过重复值 Dim Vals As List(of String()) Vals = DataTables(e.Form.Name & "_Table1").GetValues("fdate|fexp|faccountid2|facctidside|fdebit|fcredit") For i As Integer = 0 To Vals.Count - 1 Dim dr As DataRow = DataTables("现金日记账").AddNew() dr("fdate") = Vals(i)(0) dr("fexp") = Vals(i)(1) dr("faccountid2") = Vals(i)(2) dr("facctidside") = Vals(i)(3) dr("fdebit") = Vals(i)(4) dr("fcredit") = Vals(i)(5) Next DataTables("现金日记账").replacefor("_Locked",True) \'锁定行 Forms("保存窗口").show Tables("现金日记账").save Forms("保存窗口").close Dim cnt As Integer cnt = DataTables("现金日记账").SQLReplaceFor("fexp", True) MessageBox.Show("合计勾联了" & cnt & "条记录!","提示") 以上代码如何跳过重复值,帮忙修改一下代码。谢谢了!
|
-- 作者:有点甜 -- 发布时间:2017/7/13 14:52:00 -- Dim dr As DataRow = DataTables("现金日记账").AddNew()
改成
Dim dr As DataRow = DataTables("现金日记账").Find("fdate=\'" & vals(0) & "\' and fexp=\'" & vals(1) & "\'") If dr Is Nothing Then dr = DataTables("现金日记账").AddNew() |
-- 作者:zoyong -- 发布时间:2017/7/13 15:44:00 -- 编译出错 |
-- 作者:有点甜 -- 发布时间:2017/7/13 16:11:00 -- Dim dr As DataRow = DataTables("现金日记账").Find("fdate=\'" & vals(i)(0) & "\' and fexp=\'" & vals(i)(1) & "\'") If dr Is Nothing Then dr = DataTables("现金日记账").AddNew() |