Dim Ts As String() = {"产品","客户"}
Dim t As Table = Tables("窗口1_table1")
Dim dtp1 As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker1")
Dim dtp2 As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker2")
Dim v1 As Date = dtp1.value
Dim v2 As Date = dtp2.value
Dim sql,st,Lm,py,sul As String
Dim Ls As new List(of Integer)
Dim dt As DataTable
Dim cmd As New SQLCommand
cmd.C
cmd.CommandText = "SELECT * From {订单} where 日期 >= #" & v1 & "# And 日期 <= #" & v2 & "#"
dt = cmd.ExecuteReader( )
Dim sw As String = e.sender.text
st = "'%" & sw & "%'"
If sw > "" Then
For Each Lm In Ts
For Each dr As DataRow In dt.dataRows
py = GetPy(dr(lm),True)
If dr(Lm).Indexof(sw.ToUpper)> -1 OrElse py.Indexof(sw.ToUpper)> -1 Then
If Ls.Contains(dr("_Identify")) = False Then
Ls.add(dr("_Identify"))
End If
End If
Next
Next
If Ls.count > 0 Then
For Each n As Integer In Ls
sql+ = "," & n
Next
sql = "[_Identify] in (" & sql.trim(",") & ")"
sul+ = "select 产品,客户,雇员,单价,数量,日期 from (Select * from {订单} where" & sql & ")"
t.fill(sul,"yh",True)
t.AutoSizeCols()
Else If t.Rows.count > 0 Then
With t
For i As Integer = .Rows.count-1 To 0 Step -1
.Rows(i).Delete()
Next
End With
End If
End If