Dim book As NEW xls.book("C:\Users\dv rrxaI600 007\Downloads\新建文件夹\新建文件夹\现金银行.XLS") Dim Sheet As xls.Sheet = BOOK.Sheets(0) For i As Integer = 1 To Sheet.Rows.Count-1 Dim b1 As String = sheet(i,1).text Dim b2 As String = sheet(i,2).text Dim b3 As String = sheet(i,3).text Dim b4 As String = sheet(i,4).text Dim b5 As String = sheet(i,5).text Dim b7 As String = sheet(i,7).text Dim b8 As String = sheet(i,8).text Dim filter As String = "1=1" If b1 = Nothing Then filter &= " and 类别名称 = '基本帐户'" Else filter &= " and 类别名称 = '"& b1 &"'" End If If b2 = Nothing Then filter &= " and 日期 is null" Else filter &= " and 日期 = #"& b2 &"#" End If If b3 = Nothing Then filter &= " and 摘要 is null" Else filter &= " and 摘要 = '"& b3 &"'" End If If b4 = Nothing Then filter &= " and 收入 is null" Else filter &= " and 收入 = '"& b4 &"'" End If If b5 = Nothing Then filter &= " and 支出 is null" Else filter &= " and 支出 = '"& b5 &"'" End If If b7 = Nothing Then filter &= " and 对方帐户 is null" Else filter &= " and 对方帐户 = '"& b7 &"'" End If If b8 = Nothing Then filter &= " and 会计年度 is null" Else filter &= " and 会计年度 = '"& b8 &"'" End If If DataTables("现金银行").find(filter) Is Nothing Then Dim dr As Row = Tables("现金银行").AddNew() dr("类别名称") = "基本帐户" dr("日期") = sheet(i,2).text dr("摘要") = sheet(i,3).text dr("收入") = sheet(i,4).text dr("支出") = sheet(i,5).text dr("对方帐户") = sheet(i,7).text dr("会计年度") = sheet(i,8).text End If Next
|