导入按钮代码如下:
Dim dlg As New OpenFileDialog
dlg.Filter = "Excel文件|*.xls"
dlg.MultiSelect = True '允许选择多个文件
If dlg.ShowDialog =DialogResult.OK Then
Dim Book As New XLS.Book(dlg.FileName)
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Tables("实操潜能表").ResumeRedraw()
Tables("实操潜能表").StopRedraw()
Dim nms() As String = {"工作单位","县公司","姓名","性别","身份证号码","文化程度","鉴定等级","申报鉴定工种","鉴定批次","申报性质","理论成绩","实潜资格","考评分组","考核项目","考点","实操考核时间","实操考核地点","实操序号","实操成绩","潜能答辩时间","潜能序号","潜能成绩","实潜准考证号码","备注","照片"}
For n As Integer = 1 To Sheet.Rows.Count -1
Dim sfzhm As String = sheet(n,4).Text
Dim dr As DataRow = DataTables("实操潜能表").Find("身份证号码 = '" & sfzhm & "'")
If dr Is Nothing Then '如果不存在同编号的订单
dr = DataTables("实操潜能表").AddNew()
End If
For m As Integer = 0 To nms.Length - 1
If DataTables("实操潜能表").DataCols(nms(m)).IsBoolean Then
If Sheet(n,m).Value = 0 Then
dr(nms(m)) = False
Else
dr(nms(m)) = True
End If
Else If DataTables("实操潜能表").DataCols(nms(m)).Expression > "" Then
'表达式列
Else
dr(nms(m)) = Sheet(n,m).Value
End If
Next
Next
Tables("实操潜能表").ResumeRedraw()
End If
导入报错如下:
此主题相关图片如下:_rfz5vl1y8~kavhcyke19x.png
![dvubb 图片点击可在新窗口打开查看](UploadFile/2015-4/20154217533335136.png)
导入的表格如下:
为什么会报错?而且有些能导入,有些不能导入?求版主指教!!!!!!