以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 关于跨表引用数据,重置列后数据不能更新问题,求助 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=160284) |
-- 作者:piratesytu -- 发布时间:2021/1/27 15:50:00 -- 关于跨表引用数据,重置列后数据不能更新问题,求助 一个表B,从表“村干部基本信息”表中引用数据,表B DataColChanged 事件中代码如下,点击重置列对“村干部编号”列进行重置,相应引用的数据不会变化,求助各位版主 If e.DataCol.Name = "村干部编号" Then If e.NewValue Is Nothing Then e.DataRow("村干部姓名") = Nothing ElseIf e.DataRow.Isnull("村干部姓名") Dim dr As List(of DataRow) dr = DataTables("村干部基本信息").Select("[村干部编号] = \'" & e.NewValue & "\'") If dr.Count = 1 Then e.DataRow("村干部姓名") = dr(0)("姓名") e.DataRow("干部类型") = dr(0)("干部类型") Else If dr.Count < 1 Then MessageBox.Show("不存在此村干部编号!") e.DataRow("村干部编号") = Nothing End If End If End If |
-- 作者:有点蓝 -- 发布时间:2021/1/27 16:14:00 -- If e.DataCol.Name = "村干部编号" Then If e.NewValue Is Nothing Then e.DataRow("村干部姓名") = Nothing Else Dim dr As DataRow = DataTables("村干部基本信息").find("[村干部编号] = \'" & e.NewValue & "\'") If dr isnot nothing Then e.DataRow("村干部姓名") = dr("姓名") e.DataRow("干部类型") = d("干部类型") Else MessageBox.Show("不存在此村干部编号!") e.DataRow("村干部编号") = Nothing End If End If End If
|
-- 作者:piratesytu -- 发布时间:2021/1/27 16:41:00 -- 谢谢版主 [此贴子已经被作者于2021/1/27 16:44:59编辑过]
|