以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]多列组合判断重复 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=158956) |
-- 作者:chnfo -- 发布时间:2020/12/8 12:37:00 -- [求助]多列组合判断重复 表中有ABC三列。 希望ABC中的任何一列修改值时,如果A&B&C已经有相同数据,则不允许修改 select case e.col.name case "A","B","C" dim x as string = "" select case e.col.name case "A" x = e.newvalue & " " & e.datarow("B") & " " & e.datarow("C") case "B" x = e.datarow("A") & " " & e.newvalue & " " & e.datarow("C") case "C" …… end select dim dr as datarow = e.datatable.find("FullCol = \'" & x & "\'") \'这里FullCol 是A + ‘ ’ + B + ‘ ’ + C的表达式 if dr isnot nothing then e.cancel = true end if end select 感觉这样写有点麻烦了,有没有简单点的做法?
|
-- 作者:有点蓝 -- 发布时间:2020/12/8 13:34:00 -- datacolchanged事件:http://www.foxtable.com/webhelp/topics/2481.htm,看最后一种用法 select case e.datacol.name case "A","B","C" dim x as string =e.datarow("A") & " " & e.datarow("B") & " " & e.datarow("C") dim dr as datarow = e.datatable.find("FullCol = \'" & x & "\'") \'这里FullCol 是A + ‘ ’ + B + ‘ ’ + C的表达式 if dr isnot nothing then e.DataRow(e.DataCol.Name) = e.OldValue end if end select |