Dim dlg As new OpenFileDialog
dlg.Filter = "Excel|*.xls;*.xlsx"
If dlg.ShowDialog = DialogResult.OK Then
Dim Book As New XLS.Book(dlg.FileName)
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Tables("上分_table1").StopRedraw()
Dim mc As String = sheet(0,1).value
Dim dm As String = sheet(1,1).value
Dim bj As String = sheet(2,1).value
Dim ksmc As String = sheet(3,1).value
Dim kmA As String = sheet(4,1).value & "_A"
Dim kmB As String = sheet(4,1).value & "_B"
For n As Integer = 5 To Sheet.Rows.Count -1
Dim kh As String = sheet(n+1,0).value
Dim dr As DataRow = DataTables("成绩").Find("班级 = '" & bj & "'and 单位名称 = '" & mc & "' and 年级代码 = '" & dm & "'and 考试名称 = '" & ksmc & "' and 考号= '" & kh & "'")
dr(kmA) = sheet(n+1,2).value
dr(kmB) = sheet(n+1,3).value
Next
Tables("上分_table1").ResumeRedraw()
End If