以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 哪组代码高效 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=146539) |
-- 作者:tld -- 发布时间:2020/2/26 2:48:00 -- 哪组代码高效 老师好。下面的两组代码,哪个更高效些? 第一组: dim bh as string =e.row("编号") for each dr as row in tables("表A").rows if dr("编号")=bh then dr.checked = true end if next 第二组: dim bh as string =e.row("编号") dim drs as list(of datarow) =datatables("表A").select("[编号]=\'" & bh & "\'") for each dr as datarow in drs dim index as integer = tables("表A").findrow(dr) tables("表A").rows(index).checked = true next [此贴子已经被作者于2020/2/26 3:07:47编辑过]
|
-- 作者:程兴刚 -- 发布时间:2020/2/26 6:50:00 -- 第三组高效: dim bh as string =e.row("编号") dim drs as list(of datarow) =datatables("表A").select("[编号]=\'" & bh & "\'") for each dr as datarow in drs dr.checked = true next |
-- 作者:y2287958 -- 发布时间:2020/2/26 8:36:00 -- 首先,第三组代码是错误的。 另外,表格复选框就是临时用用,如果想高效点的不如增加一个逻辑列,之后使用ReplaceFor更高效。
|
-- 作者:有点蓝 -- 发布时间:2020/2/26 9:14:00 -- 代码在哪个表哪个事件的?如果不是在表A事件,使用下面用法。如果在表A事件,使用第二组 dim bh as string =e.row("编号") tables("表A").filter = "[编号]=\'" & bh & "\'"
for each dr as row in tables("表A").rows dr.checked = true next |