提示列名(物供号、类别、厂号、客款号)无效,这样写不对吗?
Dim stade As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker1")
Dim Endde As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker2")
Dim cs01 As WinForm.ComboBox = e.Form.Controls("ComboBox1")
Dim cs02 As WinForm.ComboBox = e.Form.Controls("ComboBox2")
Dim cs03 As WinForm.ComboBox = e.Form.Controls("ComboBox3")
Dim cs04 As WinForm.ComboBox = e.Form.Controls("ComboBox4")
Dim dt As DataTable=DataTables("dbscmx")
Dim filter As String = "1=1"
With e.Form.Controls("DateTimePicker1")
If .Value IsNot Nothing Then
If stade.text >"" Then
Filter = Filter & " And "
End If
' filter= filter & " and a.InDate >='" & stade.text & "'"
filter= filter & "a.InDate >='" & stade.text & "'"
End If
End With
With e.Form.Controls("DateTimePicker2")
If .Value IsNot Nothing Then
If Endde.text>"" Then
Filter = Filter & " And "
End If
' filter=filter & " and a.InDate <= '" & Endde.text & "'"
filter=filter & "a.InDate <= '" & Endde.text & "'"
End If
End With
With e.Form.Controls("ComboBox1")
If .Value IsNot Nothing Then
If cs01.text>"" Then
Filter = Filter & " And "
End If
filter=filter & "[物供号] = '" & cs01.text & "'"
End If
End With
With e.Form.Controls("ComboBox2")
If .Value IsNot Nothing Then
If cs02.text>"" Then
Filter = Filter & " And "
End If
filter=filter & "[类别] = '" & cs02.text & "'"
End If
End With
With e.Form.Controls("ComboBox3")
If .Value IsNot Nothing Then
If cs03.text>"" Then
Filter = Filter & " And "
End If
filter=filter & "[厂号] = '" & cs03.text & "'"
End If
End With
With e.Form.Controls("ComboBox4")
If .Value IsNot Nothing Then
If cs04.text>"" Then
Filter = Filter & " And "
End If
filter=filter & "[客款号] = '" & cs04.text & "'"
End If
End With
If Filter > "" Then
dt.LoadFilter=filter
dt.Load()
End If