象这种多列条件,是不是其中一列为空,那么filter是不是就不成立 ?是不是每一列都要判断一下是否为空?要怎么写?
其中一列为空条件就不成立了。
具体要什么效果?比如上面的4个列,4个列都有数据就查4个列?只有3个列有数据就只查3个列?
Select Case e.DataCol.Name Case "销方名称","货物或应税劳务名称","fa piaopiao种","fa piao归类" |
dim filter as string = "经营单位= '" & _jydw &"'"
dim nms1() as string = {"销方名称","货物或应税劳务名称","fa piaopiao种"}
dim nms2() as string = {"供应商名称","开piao内容","fa piaopiao种"}
for i as integer = 0 to nms1.length - 1
if e.DataRow.isnull(nms1(i)) = false then
filter = filter & " and " & nms2(i) & " = '" & e.DataRow(nms1(i)) & "'"
end if
next
pr1 = DataTables("凭证规则").sqlFind(filter )
If pr1 IsNot Nothing Then
e.DataRow("名称") = pr1("名称")
end if
对的。就是你说的意思。先查四个条件都满足的。然后找3个条件满足的。filter1 ="供应商名称= '" & e.DataRow("销方名称") & "'and 开piao内容= '" & e.DataRow("货物或应税劳务名称") & "'and fa piaopiao种= '" & e.DataRow("fa piaopiao种") & "' and 经营单位= '"& _jydw &"'"
filter2 ="供应商名称= '" & e.DataRow("销方名称") & "'and fa piaopiao种= '" & e.DataRow("fa piaopiao种") & "' and 经营单位= '"& _jydw &"'"
filter3 ="开piao内容= '" & e.DataRow("货物或应税劳务名称") & "'and fa piaopiao种= '" & e.DataRow("fa piaopiao种") & "' and 经营单位= '"& _jydw &"'"
filter4 ="fa piao归类= '" & e.DataRow("fa piao归类") & "' and 经营单位= '"& _jydw &"'"
您这个和我说的又不是一回事了。4楼这种只能分开,查4次