Dim ZhcxFilter As String = args(0)
Dim dt As Table = args(1)
Dim dr As Row = args(2)
Dim d As Date = args(3)
Dim Zxbz As Boolean = args(4)
For i As Integer = 0 To Tables("查询条件明细").count-1
dr= Tables("查询条件明细").Rows(i)
If i = 0 Then
If dt.Cols(dr("查询字段")).IsDate Then
If Date.TryParse(dr("条件值"), d) Then
ZhcxFilter = ZhcxFilter & " and " & dr("查询字段") & " " & dr("运算符") & " '" & dr("条件值") & "'"
Else
MessageBox.show("HI," & iif(_usersex="男","师哥:","美女:") & vbcrlf & "日期不合法,我只能认出'yyyy-mm-dd'格式的日期,请重新核对!")
Zxbz = False
Return Zxbz
End If
ElseIf dt.Cols(dr("查询字段")).IsNumeric Then
ZhcxFilter = ZhcxFilter & " and " & dr("查询字段") & " " & dr("运算符") & " " & dr("条件值")
Else
If dr("运算符") ="like" Then
ZhcxFilter = ZhcxFilter & " and " & dr("查询字段") & " " & dr("运算符") & " '%" & dr("条件值") & "%'"
Else
ZhcxFilter = ZhcxFilter & " and " & dr("查询字段") & " " & dr("运算符") & " '" & dr("条件值") & "'"
End If
End If
Else
If dr("关系符") = "and" Then
If dt.Cols(dr("查询字段")).IsDate Then
If Date.TryParse(dr("条件值"), d) Then
ZhcxFilter = ZhcxFilter & " and " & dr("查询字段") & " " & dr("运算符") & " '" & dr("条件值") & "'"
Else
MessageBox.show("日期不合法,请重新核对!")
Zxbz = False
Return Zxbz
End If
ElseIf dt.Cols(dr("查询字段")).IsNumeric Then
ZhcxFilter = ZhcxFilter & " and " & dr("查询字段") & " " & dr("运算符") & " " & dr("条件值")
Else
If dr("运算符") ="like" Then
ZhcxFilter = ZhcxFilter & " and " & dr("查询字段") & " " & dr("运算符") & " '%" & dr("条件值") & "%'"
Else
ZhcxFilter = ZhcxFilter & " and " & dr("查询字段") & " " & dr("运算符") & " '" & dr("条件值") & "'"
End If
End If
Else
If dt.Cols(dr("查询字段")).IsDate Then
If Date.TryParse(dr("条件值"), d) Then
ZhcxFilter = ZhcxFilter & " or " & SysFilter & " And " & dr("查询字段") & " " & dr("运算符") & " '" & dr("条件值") & "'"
Else
MessageBox.show("日期不合法,请重新核对!")
Zxbz = False
Return Zxbz
End If
ElseIf dt.Cols(dr("查询字段")).IsNumeric Then
ZhcxFilter = ZhcxFilter & " or " & SysFilter & " and " & dr("查询字段") & " " & dr("运算符") & " " & dr("条件值")
Else
If dr("运算符") ="like" Then
ZhcxFilter = ZhcxFilter & " or " & SysFilter & " and " & dr("查询字段") & " " & dr("运算符") & " '%" & dr("条件值") & "%'"
Else
ZhcxFilter = ZhcxFilter & " or " & SysFilter & " and " & dr("查询字段") & " " & dr("运算符") & " '" & dr("条件值") & "'"
End If
End If
End If
End If
Next
Return ZhcxFilter