怎样改这段代码
Dim dr1 As DataRow = DataTables("T246").SQLFind("[F4411] Is Not Null", "F4411", 0)
Dim dr2 As DataRow = DataTables("T246").SQLFind("[F4411] Is Not Null", "F4411 Desc",0)
If dr1 Is Nothing OrElse dr2 Is Nothing Then Return
Dim d1 As Date
Dim d2 As Date
Dim drl0 As DataRow
Dim dt1 As Date =dr1("F4411")
Dim dt2 As Date =dr2("F4411")
Dim val1 As New List (of String)
val1= DataTables("T246").GetValues("F4386")
Dim d As Integer = dt2.Year -dt1.Year
Dim j As Integer = 0
Dim drl As New List (of DataRow)
For i As Integer = 0 To d
d1 = New Date(dt1.Year+i-1,11,5) '取得该年的第一天
d2 = new Date(dt1.Year+i,11,5) '取得该年的最后一天
For Each val As String In val1
drl0 = DataTables("T246").Find("[F4411] >= #" & d1 & "# And [F4411] <= #" & d2 & "# And [F4386] ='" & val & "'","F4411 Desc",0)
If drl0 IsNot Nothing Then
drl.add(drl0)
j= j+1
End If
Next
Next
For k As Integer = 0 To j-1
If Filter > "" Then
Filter = Filter & " or "
End If
filter = filter & "[T246Id] = '" & drl(k)("T246Id") & "'"
Next
使它能够从外部数据源筛选出数据呢?
(这段代码大概的意思是在每年的上一年11月5日到下一年的11月5日之间从这一年段的若干条记录筛选出最晚的记录,就是最接近下一年11月5日的记录)
ps:F4411是日期,T246是表,F4386是用户姓名,T246ID是唯一标识每一行。