Dim st1 As Date = Date.Now()
DataTables(maintable.Name).RemoveFor("")
Dim dlg As New OpenFileDialog
dlg.Filter = "Excel文件|*.xls;*.xlsx"
If dlg.ShowDialog = DialogResult.Ok Then
Dim mg As New Merger
mg.SourcePath = dlg.FileName
mg.Format = "excel"
mg.SourceTableName = MainTable.name & "$"
mg.DataTableName = maintable.Name
mg.Merge()
If MainTable.Rows.Count > 0 Then
Dim Result As DialogResult
Result = MessageBox.Show("确定导入数据?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If Result = DialogResult.Yes Then
Dim db = HySql.DataBaseFactory.CreateDatabase()
db.BulkInsert(DataTables(maintable.name).BaseTable, maintable.name)
Dim dt As Date = Date.Now
Dim sp As New TimeSpan(0, 0, 30)
Dim dt2 As Date = dt - sp
DataTables(maintable.Name).RemoveFor("")
DataTables(maintable.Name).LoadFilter = "[操作员] = '" & user.Name & "' and [操作日期] Between '" & dt2 & "' And '" & dt & "'"
DataTables(maintable.Name).Load()
Else
DataTables(maintable.Name).RemoveFor("")
End If
End If
End If
MessageBox.Show("耗时: " & (Date.Now - st1).TotalSeconds & "秒")
用以上代码合并数据,出现如下错误提示:
.NET Framework 版本:4.0.30319.42000
Foxtable 版本:2022.8.18.1
错误所在事件:窗口,客户查询,导入,Click
详细错误信息:
从索引 0 处开始,初始化字符串的格式不符合规范。