以下是引用jianjingmaoyi在2014-8-31 14:28:00的发言:不应该这个问题呀
Dim nms As String
Dim nmsx As String
Dim drs As List(of DataRow) = DataTables("查询权限").SQLSelect("管理员ID = '" & _UserID & "'")
If drs.Count > 0 Then
For Each dr As DataRow In drs
nms = nms & ",'" & dr("查询单位") & "'"
Next
For Each dr As DataRow In drs
nmsx = nmsx & ",'" & dr("查询部门") & "'" 这里和上面,似乎加上空值判断 更为合理
Next
End If
If nmsx > "" And nms > "" Then 这里分开判断比较好。并且直接把拼接变量做完 nmsx = " And 主管部门 In (" & nmsx & ")" )
nms = nms.Trim(",")
nmsx = nmsx.Trim(",")
Filter = Filter & " And " & "报表名称 Like '%" & e.node.Name & "%' And 纳税人识别号='" & e.Node.ParentNode.Name & "'And 主管税务机关 In (" & nms & ") And 主管部门 In (" & nmsx & ")"
End If
Tables(e.Form.Name & "_Table1").Fill("select* from{企业所得税税收优惠备案管理台账} Where " & Filter ,"服务器",True)