以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  假设表A有名字1,名字2两列,表B有名字3这一列,如何判断字符串Str是否包含在他们之间,只要有一列包含也可以  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=118048)

--  作者:一叶知秋
--  发布时间:2018/4/24 9:36:00
--  假设表A有名字1,名字2两列,表B有名字3这一列,如何判断字符串Str是否包含在他们之间,只要有一列包含也可以
假设表A有名字1,名字2两列,表B有名字3这一列,如何判断字符串Str是否包含在他们之间,只要有一列包含也可以
--  作者:有点甜
--  发布时间:2018/4/24 9:53:00
--  

Dim str As String = "123"

Dim fdr As DataRow = DataTables("表A").Find("名字1 like \'%" & str & "%\' Or 名字2 like \'%" & str & "%\'")

If fdr is Nothing then

    fdr = DataTables("表B").Find("名字3 like \'%" & str & "%\'")

    If fdr Is Nothing Then

        msgbox("不包含")

        return

    End If

End If

msgbox("包含")


--  作者:一叶知秋
--  发布时间:2018/4/24 11:58:00
--  
这里,可不可以实现str与名字完全对应呢,而不只是有些字符类似而已,就是说,str==名字
--  作者:有点甜
--  发布时间:2018/4/24 12:09:00
--  

Dim str As String = "123"

Dim fdr As DataRow = DataTables("表A").Find("名字1 = \'" & str & "\' Or 名字2 = \'" & str & "\'")

If fdr is Nothing then

    fdr = DataTables("表B").Find("名字3 = \'" & str & "\'")

    If fdr Is Nothing Then

        msgbox("不包含")

        return

    End If

End If

msgbox("包含")


--  作者:一叶知秋
--  发布时间:2018/4/24 14:22:00
--  
老师。这个要怎么解决呢,写return “”  会有执行结果出现

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


--  作者:有点甜
--  发布时间:2018/4/24 14:50:00
--  

Dim str As String = "123"

Dim fdr As DataRow = DataTables("表A").Find("名字1 = \'" & str & "\' Or 名字2 = \'" & str & "\'")

If fdr is Nothing then

    fdr = DataTables("表B").Find("名字3 = \'" & str & "\'")

    If fdr Is Nothing Then

        msgbox("不包含")

    else

        msgbox("包含")

    End If

Else

    msgbox("包含")

End If

 


--  作者:一叶知秋
--  发布时间:2018/4/24 15:31:00
--  
谢谢老师