以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  关于字符含有的字段的判定  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=133377)

--  作者:benwong2013
--  发布时间:2019/4/13 9:22:00
--  关于字符含有的字段的判定
比如

txt = b
old = a
r("授权模块“) = a,c,d,e,f

以下代码   If ("," & old & ",").Contains("," & r("授权模块") & ",") Then 在判定却是为false的,请问问题在哪里?

Dim txt As String = e.Form.Controls("替换模块").Value
Dim old As String = e.Form.Controls("授权模块").Value
If old IsNot Nothing Then
    If txt IsNot Nothing Then
        If Tables("0107角色授权_Table1").Rows.Count > 0 Then
            For Each r As Row In Tables("0107角色授权_Table1").Rows
                If ("," & old & ",").Contains("," & r("授权模块") & ",") Then
                    r("授权模块") = r("授权模块").Replace(old,txt)
                    r.save
                Else
                    MessageBox.Show("角色名为【" & r("角色名") & "】未找到授权模块,无法完成替换,请知悉!","温馨提示")
                End If
            Next
        Else
            MessageBox.Show("清单中未有数据,请确认之后再操作,谢谢!","温馨提示")
            Return
        End If
    Else
        MessageBox.Show("请选择您需要替换后模块的名称,谢谢!","温馨提示")
    End If
Else
    MessageBox.Show("请选择您需要替换模块的名称,谢谢!","温馨提示")
End If

--  作者:有点蓝
--  发布时间:2019/4/13 9:40:00
--  
If ("," & r("授权模块") & ",").Contains("," & old & ",") Then