数据合并时,出现有一列数据没有导入,请老师看看。
此主题相关图片如下:1.png

Dim pr As Integer = DataTables("检查").DataRows.Count '查询表行数
Dim dlg As New OpenFileDialog '定义一个新的OpenFileDialog
dlg.Filter= "excel文件|*.xls" '设置筛选器
dlg.MultiSelect = True '允许选择多个文件
If dlg.ShowDialog = DialogResult.Ok Then '如果用户单击了确定按钮
e.Form.Controls("Label1").Text = "正在合并,请稍后..."
Application.DoEvents()
Dim mg As New Merger
For Each fl As String In dlg.FileNames
mg.SourcePath = fl '指定数据文件
mg.Format = "excel" '指定格式
mg.SourceTableName = "检查$" '指定要合并的表
mg.DataTableName = "检查" '指定接收数据的表
mg.Merge() '开始合并
Next
Dim i As Integer
For i = DataTables("检查").DataRows.Count-1 To 0 Step -1
Dim dr As DataRow = DataTables("检查").DataRows(i)
Dim dr2 As DataRow = DataTables("检查").Find("编号='" & dr("编号") & "' and _Identify <> " & dr("_Identify"))
If dr2 IsNot Nothing Then
dr2.Delete
End If
Next '去重复值
'
DataTables("检查").DeleteFor("[管理号码] is null or [良品] is null") '删除空白行
pr = DataTables("检查").DataRows.Count - pr '查询表行数
MessageBox.Show("成功导入数据"& pr &"条","提示")
e.Form.Controls("Label1").Text = ""
Syscmd.Table.ToggleSortAndFilter()
DataTables("检查").Save()
End If
[此贴子已经被作者于2015/7/13 15:47:18编辑过]