Dim dlg As New OpenFileDialog
dlg.Filter = "Excel文件|*.xls;*.xlsx"
If dlg.ShowDialog =DialogResult.OK Then
'DataTables("干警信息").sqlDeleteFor("所在单位='"& _UserGroup & "'")
Dim t As Table = Tables("干警信息")
t.StopRedraw()
Dim Book As New XLS.Book(dlg.FileName)
Dim Sheet As XLS.Sheet = Book.Sheets(0)
For n As Integer = 1 To Sheet.Rows.Count -1
Dim r As DataRow = t.DataTable.Find("姓名 = '" & sheet(n,0).text & "' and 单位='" & sheet(n,xxx).text & "' and 电话号码='" & sheet(n,xxx2).text & "'")
If r Is Nothing Then
r = t.DataTable.AddNew()
For i As Integer = 0 To sheet.Cols.Count -1
Dim cname As String = sheet(0, i).text
If t.Cols.Contains(cname) Then
r(cname) = sheet(n, i).Text
End If
Next
END IF
Next
t.ResumeRedraw()
End If
DataTables("干警信息").LoadFilter="所在单位='"& _UserGroup & "'"
DataTables("干警信息").Load