以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]锁定关联表得问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=48305)

--  作者:viking
--  发布时间:2014/3/26 22:35:00
--  [求助]锁定关联表得问题

父表:表A

字表:表A.表B

表A中    当前行    的第一列内容为“中国”和“美国”时

锁定表A.表B的  关联行 

是表A  当前行  相应的 关联行,不是整个字表!!!

求解答,本人菜鸟,谢谢


--  作者:有点甜
--  发布时间:2014/3/26 22:45:00
--  

你可以设置子表的prepareedit事件:

 

Dim r As DataRow = e.Row.DataRow.GetParent("父表")
If r IsNot Nothing Then
    If r("列名") = "中国" OrElse r("列名")  = "美国" Then
        e.cancel = True
    End If
End If

 


--  作者:viking
--  发布时间:2014/3/26 22:54:00
--  
以下是引用有点甜在2014-3-26 22:45:00的发言:

你可以设置子表的prepareedit事件:

 

Dim r As DataRow = e.Row.DataRow.GetParent("父表")
If r IsNot Nothing Then
    If r("列名") = "中国" OrElse r("列名")  = "美国" Then
        e.cancel = True
    End If
End If

 

GetParent

不是

datarow

成员

 

Dim r As DataRow = e.Row.DataRow.GetParent("父表")
说这个不对


--  作者:有点甜
--  发布时间:2014/3/26 23:00:00
--  
Dim r As DataRow = e.Row.DataRow.GetParentrow("父表")
If r IsNot Nothing Then
    If r("列名") = "中国" OrElse r("列名")  = "美国" Then
        e.cancel = True
    End If
End If

--  作者:viking
--  发布时间:2014/3/26 23:12:00
--  
以下是引用有点甜在2014-3-26 23:00:00的发言:
Dim r As DataRow = e.Row.DataRow.GetParentrow("父表")
If r IsNot Nothing Then
    If r("列名") = "中国" OrElse r("列名")  = "美国" Then
        e.cancel = True
    End If
End If

问下,如果两个表之间如果不是关联表得关系,这个还有效吗?

 


--  作者:有点甜
--  发布时间:2014/3/26 23:13:00
--  

Dim r As DataRow = e.Row.DataRow.GetParentrow("父表")

 

改为:

 

Dim r As DataRow = Datatables("父表").Find("关联列 =\'" & e.row("关联列") & ”’“)


--  作者:viking
--  发布时间:2014/3/26 23:26:00
--  
以下是引用有点甜在2014-3-26 23:13:00的发言:

Dim r As DataRow = e.Row.DataRow.GetParentrow("父表")

 

改为:

 

Dim r As DataRow = Datatables("父表").Find("关联列 =\'" & e.row("关联列") & ”’“)

谢谢,

你这个名字是农夫?

农夫山泉,有点甜???