以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 代码修改 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=171150) |
-- 作者:jick0526 -- 发布时间:2021/8/19 19:31:00 -- 代码修改 老师,请问下,下面这段代码,如果我想加一个前提条件,如果K列为空,则不执行下面代码,如果不为空则执行下面的代码,改怎么修改,麻烦老师帮忙改下,谢谢! Select Case e.DataCol.Name Case "A列","B列","C列","D列" Dim dr As DataRow = e.DataRow Dim pr As DataRow If dr.IsNull("A列") OrElse dr.IsNull("B列") OrElse dr.IsNull("C列") OrElse dr.IsNull("D列") Then dr("F列") = Nothing Else Dim filter As String filter = "A列 <> \'" & dr("A列") & "\' And B列 = \'" & dr("B列") & "\' And D列 = \'" & dr("D列") & "\' And C列 = \'" & dr("C列") & "\'" pr = DataTables("表C").Find(filter) If pr IsNot Nothing Then e.DataRow("F列") = "错误" Else End If End If End Select
|
-- 作者:有点蓝 -- 发布时间:2021/8/19 20:27:00 -- Select Case e.DataCol.Name Case "A列","B列","C列","D列" if e.DataRow.IsNull("k列") = false then ……
|
-- 作者:jick0526 -- 发布时间:2021/8/19 20:52:00 -- 老师,我试了下不行,能帮我看下哪里错了吗?谢谢! Select Case e.DataCol.Name Case "A列","B列","C列","D列" If e.DataRow.IsNull("K列") = False Then Select Case e.DataCol.Name Case "A列","B列","C列","D列" Dim dr As DataRow = e.DataRow Dim pr As DataRow If dr.IsNull("A列") OrElse dr.IsNull("B列") OrElse dr.IsNull("C列") OrElse dr.IsNull("D列") Then dr("F列") = Nothing Else Dim filter As String filter = "A列 <> \'" & dr("A列") & "\' And B列 = \'" & dr("B列") & "\' And D列 = \'" & dr("D列") & "\' And C列 = \'" & dr("C列") & "\'" pr = DataTables("Today").Find(filter) If pr IsNot Nothing Then e.DataRow("F列") = "错误" Else End If End If End Select
|
-- 作者:有点蓝 -- 发布时间:2021/8/19 21:21:00 -- 哪里不行?提示什么错误? |
-- 作者:jick0526 -- 发布时间:2021/8/19 21:36:00 -- 提示这个错误 编译错误:Select Case必须以匹配 End Select 结束 错误代码 Case "A列","B列","C列","D列"
|
-- 作者:有点蓝 -- 发布时间:2021/8/19 22:00:00 -- Select Case e.DataCol.Name Case "A列","B列","C列","D列" If e.DataRow.IsNull("K列") = False Then Dim dr As DataRow = e.DataRow Dim pr As DataRow If dr.IsNull("A列") OrElse dr.IsNull("B列") OrElse dr.IsNull("C列") OrElse dr.IsNull("D列") Then dr("F列") = Nothing Else Dim filter As String filter = "A列 <> \'" & dr("A列") & "\' And B列 = \'" & dr("B列") & "\' And D列 = \'" & dr("D列") & "\' And C列 = \'" & dr("C列") & "\'" pr = DataTables("Today").Find(filter) If pr IsNot Nothing Then e.DataRow("F列") = "错误" Else End If End If End If End Select
|