以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 不新增行的情况下提取数据 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=75001) |
-- 作者:shiliwhy_91641 -- 发布时间:2015/9/24 11:26:00 -- 不新增行的情况下提取数据 如下的代码如何改进才能在不新增行的情况下提取数据 For Each file As String In filesys .GetFiles("D:\\数据存放") If file.EndsWith(".xls") OrElse file.EndsWith(".xlsx") Then Dim Book As New XLS.Book(file) Dim Sheet As XLS.Sheet = Book.Sheets(0) Dim dr As DataRow = DataTables("订单数据").AddNew dr("零配件") = sheet(4,1).text dr("件数") = sheet(4,3).text dr("规格") = sheet(5,1).text dr("厚度") = sheet(5,3).text dr("颜色") = sheet(6,1).text End If Next |
-- 作者:大红袍 -- 发布时间:2015/9/24 11:28:00 -- For Each file As String In filesys .GetFiles("D:\\数据存放") If file.EndsWith(".xls") OrElse file.EndsWith(".xlsx") Then Dim Book As New XLS.Book(file) Dim Sheet As XLS.Sheet = Book.Sheets(0) Dim dr As DataRow = DataTables("订单数据").Find("编号 = \'" & sheet(4,1).text & "\'") If dr Is Nothing Then dr = DataTables("订单数据").AddNew End If dr("零配件") = sheet(4,1).text dr("件数") = sheet(4,3).text dr("规格") = sheet(5,1).text dr("厚度") = sheet(5,3).text dr("颜色") = sheet(6,1).text End If Next |
-- 作者:shiliwhy_91641 -- 发布时间:2015/9/24 11:36:00 -- 搞定,谢了! |