以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]导入出错  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=126088)

--  作者:lmao
--  发布时间:2018/10/13 18:55:00
--  [求助]导入出错
老师,

数据导人:Dim Book As New XLS.Book("c:\\data\\qqq.xls")
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Tables("qqq").StopRedraw()
Dim nms() As String = {"编号","产品","日期"}
For n As Integer = 1 To Sheet.Rows.Count -1 
    Dim bh As String = sheet(n,0).Text 
    Dim dr As DataRow = DataTables("qqq").Find("编号 = \'" & bh & "\'") 
    If dr Is Nothing Then \'如果不存在同编号的订单
        dr =  DataTables("qqq").AddNew()
    End If
    For m As Integer = 0 To nms.Length - 1
        dr(nms(m)) = Sheet(n,m).Value
    Next
Next
Tables("qqq").ResumeRedraw()
    提示:从字符串“”到类型“Date”的转换无效。在excel中怎么改日期都无效。我用的是office2007,导出后再导入就不行了。请教老师如何处理?




--  作者:有点甜
--  发布时间:2018/10/14 18:15:00
--  

参考

 

http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=123476&skin=0