以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  代码问题 求助 主表锁定后 关联表禁止新增  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=157767)

--  作者:夜点蚊香
--  发布时间:2020/10/28 11:30:00
--  代码问题 求助 主表锁定后 关联表禁止新增
关联表 
BeforeAddDataRow
事件 代码如下
Dim dr As DataRow = DataTables("学生排课档案").Datarows(0)
Dim pr As DataRow = dr.GetParentrow("课程档案DAY")
If pr.Locked = True Then \'判断主表状态
    e.Cancel = True \'那么取消输入并提示用户
    Messagebox.Show("已经下课了,不能进行操作了,如需造作需要经理授权!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If

现在主表锁定后,关联表还是可以新增操作

--  作者:有点蓝
--  发布时间:2020/10/28 11:32:00
--  
if Tables("学生排课档案").current isnot nothing
Dim dr As DataRow = Tables("学生排课档案").current.Datarow
Dim pr As DataRow = dr.GetParentrow("课程档案DAY")