以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 老师您好可以帮我看一下这串代码嘛 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=171525) |
-- 作者:aaa1234 -- 发布时间:2021/9/2 9:31:00 -- 老师您好可以帮我看一下这串代码嘛 Dim dlg As New OpenFileDialog \'定义一个新的OpenFileDialog dlg.Filter= "Excel文件|*.xlsx|Word文件|*.doc|Access文件|*.mdb" \'设置筛选器 If dlg.ShowDialog = DialogResult.Ok Then \'如果用户单击了确定按钮 Dim nms() As String = {"状态","记录时间","店铺名称","产品类别","单号","产品SKU","责任方","状况描述 原因","客户姓名","联系方式","寄送地址","处理方式","寄送SKU","配件SKU","数量","备注","发货仓库","系统单号","追踪号","物流公司","发货日期","收货日期","下单日期","回访","记录日期","结束日期","赠送SKU","处理时间"} Dim nms2() As String = {"状态","记录时间","店铺名称","产品类别","单号","产品SKU","责任方","状况描述 原因","客户姓名","联系方式","寄送地址","处理方式","寄送SKU","配件SKU","数量","备注","发货仓库","系统单号","追踪号","物流公司","发货日期","收货日期","下单日期","回访","记录日期","结束日期","赠送SKU","处理时间"} Dim dict As new Dictionary(of String,String) For m As Integer = 0 To nms.Length - 1 dict.add(nms2(m),nms(m)) Next Dim Book As New XLS.Book(dlg.FileName) Dim Sheet As XLS.Sheet = Book.Sheets(0) Tables("table_3").StopRedraw() \'注意下面的循环变量从1开始,而不是从0开始,因为Excel表的第一行是标题 For n As Integer = 1 To Sheet.Rows.Count -1 Dim bh As String = sheet(n,0).Text If DataTables("table_3").Find("单号 = \'" & bh & "\'")Is Nothing Then Dim r As Row = Tables("table_3").AddNew() For m1 As Integer = 0 To Sheet.Cols.Count - 1 If dict.ContainsKey(Sheet(0,m1).Value) r(dict(Sheet(0,m1).Value)) = Sheet(n,m1).Value End If Next r("处理人") = user.name End If Next msgbox("导入成功") End If
|
-- 作者:aaa1234 -- 发布时间:2021/9/2 9:31:00 -- 依然导入相同的数据 |
-- 作者:aaa1234 -- 发布时间:2021/9/2 9:31:00 -- 相同的单号依然能导入 |
-- 作者:有点蓝 -- 发布时间:2021/9/2 9:36:00 -- 请上传实例测试 |
-- 作者:aaa1234 -- 发布时间:2021/9/2 9:43:00 -- 但是我这个是连数据库的 怎么转内部表
|
-- 作者:有点蓝 -- 发布时间:2021/9/2 9:48:00 -- http://www.foxtable.com/webhelp/topics/2297.htm |
-- 作者:aaa1234 -- 发布时间:2021/9/2 10:09:00 -- 他说我没有关键建 |
-- 作者:有点蓝 -- 发布时间:2021/9/2 10:17:00 -- 可以导出到access数据库 |
-- 作者:aaa1234 -- 发布时间:2021/9/2 10:26:00 -- 111 [此贴子已经被作者于2021/9/2 10:26:45编辑过]
|
-- 作者:aaa1234 -- 发布时间:2021/9/2 10:26:00 -- 发了吗 |