If e.DataCol.Name = "出库数量" and e.DataRow("客户") = "科顺" Then
Dim d1 As String = Format(date.today,"yyyyMMdd") '取得日期的8位数
Dim d2 As String = d1.substring(4,4)
Dim t1 As TimeSpan = CDate(CurrentTable.Current("出入库日期"))
dim t2 as integer = t1.hours
dim t3 as integer = t1.minutes
dim t4 as integer = t1.seconds
dim t5 as integer = t1.milliseconds
dim h1 as string
if t2.length = 1
H1 = "0" & t2
else
H1 = t2
end if
dim m1 as string
if m1.length = 1
m1 = "0" & t3
else
m1 = t3
end if
dim s1 as string
if t4.length = 1
s1 = "0" & t4
else
s1 = t4
end if
dim ms1 as string
if t5.length = 1
ms1 = "00" & t5
elseif ms1.length = 2
ms1 = "0" & t5
else
ms1 = t5
end if
e.DataRow("条形码") = d2 & h1 & m1 & s1 & ms1
end if
我希望将"出入库日期"这栏的日、时、分、秒、毫秒(比如2019-07-09 12:30:25:221)转换为字符串 0709123025221 作为条形码使用,但是上述代码出现警告:date 值无法转换为 system.timespan
请教如何处理。谢谢。