以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]逻辑列行排他  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=144529)

--  作者:天一生水
--  发布时间:2019/12/23 16:50:00
--  [求助]逻辑列行排他

老师好!

数据表中的每个用户,只能勾选一个默认邮箱,怎样写事件?

谢谢!

 


图片点击可在新窗口打开查看此主题相关图片如下:截屏图片.jpg
图片点击可在新窗口打开查看


--  作者:有点蓝
--  发布时间:2019/12/23 16:59:00
--  
datacolchanging事件使用find查询是否有已经勾选的同名的其它行
--  作者:天一生水
--  发布时间:2019/12/23 18:31:00
--  
加黑代码保存不了,老师给看看。

DataColChanging事件:

If e.DataCol.Name = "设为默认" Then
    If e.NewValue = True Then
        Dim dr As DataRow
        dr = e.DataTable.Find("用户名 = \'" & e.Table.Current("用户名") & "\' and 设为默认 = true")
        If dr IsNot Nothing Then
            dr("设为默认") = False
        End If
    End If
End If

--  作者:有点蓝
--  发布时间:2019/12/23 20:26:00
--  

DataColChanging事件:

If e.DataCol.Name = "设为默认" Then
    If e.NewValue = True Then
e.DataTable.ReplaceFor("设为默认",false,"设为默认=true and _Identify <>" & e.datarow("_Identify"))
    End If
End If