-- 已有数据不再导入
将EXCEL表数据导入孤表:条件是1、已有会计月份的不再导入,2、营收为空的不导入,现在就是已有会计月份的还是可以导入
Dim App As New MSExcel.Application
\'\'\'\'\'\'导入利润表带条件判断导入
Dim str1 = e.Form.Controls("TextBox1").value
Dim str2 = e.Form.Controls("ComboBox1").value
Dim Book As New XLS.Book(str1)
Dim Sheet As XLS.Sheet = Book.Sheets(str2)
For i As Integer = 1 To 12
Dim tt As Table = Tables("利润表")
Dim b1 As String = sheet(1,i).Text
\'Dim b2 = CStr(b1)
Dim dr As DataRow
dr = DataTables("利润表").Find("会计月份 = \'" & b1 & "\'")
If dr Is Nothing And sheet(1,i).Text <> "" Then
Dim dr1 As DataRow = DataTables("利润表").AddNew
dr1("公司名称") = e.Form.Controls("ComboBox4").value
dr1("会计月份") = sheet(0,i).Text
dr1("营业收入") = sheet(1,i).Text
End If
Next
MessageBox.Show("已导入""提示") \'提示用户选择的文件
\'\'\'\'\'\'导入利润表带条件判断导入
dr Is Nothing这个条件还是起不到作用,还是可以导入已有会计月份的数据