老师好,我需要把Excel中的数据用代码有选择性的提取到foxtable中处理。
其中有一个日期时间型的列,Excel中对应列显示日期和时间,比如:2019-05-24 14:28:37
导入到foxtable中后就变成2019-05-24 00:00:00了,我也用了format对单元格提取的值进行格式化,但是也还是这样的。
比如我下面的代码加粗部分:
For r As Integer = 1 To SheetList.Rows.Count - 1
Dim nr As DataRow = Rdt_ListZ.AddNew()
For c As Integer = 0 To SheetList.Cols.Count - 1
SheetColName = SheetList(0, c).Text
loc = NewCaps.IndexOf(SheetColName)
Select Case NewCaps(loc)
Case "Sold Out"
nr("Sold") = IIF(SheetList(r,c).Value = "Yes", True, False)
Case "Bill Date"
nr("BillDate") = Format(CDate(SheetList(r,c).Text), "yyyy-MM-dd HH:mm:ss")
Case Else
nr(NewSeri(c)) = SheetList(r,c).Value
End Select
Next
请问老师,这个问题怎么解决?谢谢。