上传不了,太慢。直接贴代码。
Dim dlg As New OpenFileDialog dlg.MultiSelect = True dlg.Filter= "数据库文件|*.dbf;*.xls;*.xlsx|全部|*.*" If dlg.ShowDialog = DialogResult.OK Then For Each fl As String In dlg.FileNames If fl.ToLower.EndsWith(".dbf") Then Dim wjm As String = FileSys.GetName(fl) Dim mg As New Merger mg.SourcePath = FileSys.GetParentPath(fl) '指定数据文件所在目录 mg.Format = "dbase" '指定格式 mg.SourceTableName = wjm '指定要合并的dbase文件,无需扩展名 mg.DataTableName = "成绩库" '指定接收数据的表 mg.Merge() '开始合并 Else If fl.ToLower.EndsWith(".xls") Then Dim Book As New XLS.Book(fl) For Each Sheet As XLS.Sheet In Book.Sheets '引用新增加的工作表 Dim mg As New Merger mg.SourcePath = fl '指定数据文件所在目录 mg.Format = "excel" '指定格式 mg.SourceTableName = sheet.Name & "$" mg.DataTableName = "成绩库" '指定接收数据的表 mg.Merge() '开始合并 Next End If Next End If e.Form.Controls("Label1").Text = "数据导入结束,可以进行分项统计!"
|