以下是引用jimmyhwang在2014-5-10 20:45:00的发言:
还是同样的问题。没解决。同样提示字符串类型转换为Date失效
Dim d1 As Date = #1/1/1970 08:00:00#
Dim cmd As New SQLCommand
Dim dt As DataTable
Dim sCols() As String = {"AddTime"}
Dim dCols() As String = {"日期"}
cmd.C
cmd.CommandText = "SELECT * From (orderson INNER JOIN orderlist ON orderson.OrderNumber = orderlist.OrderNumber) INNER JOIN vipuser ON orderlist.UserName = vipuser.UserName Order By orderson.WeiZhi "
dt = cmd.ExecuteReader()
DataTables("小包发货单").StopRedraw()
For Each dr As DataRow In dt.DataRows
If DataTables("小包发货单").Find("编号 = '" & dr("OrderNumber") & "' And ID ='" & dr("ID") & "'") Is Nothing Then
Dim nr As DataRow = DataTables("小包发货单").AddNew()
nr("日期") = d1.AddSeconds(Val(dr("AddTime")))
For i As Integer =0 To sCols.Length -1
nr(dCols(i)) = dr(sCols(i)) '这里好像不妥 翻过来就是 nr("日期")=dr("AddTime"),这两个的类型不同
Next
End If
Next
DataTables("小包发货单").ResumeRedraw()
[此贴子已经被作者于2014-5-10 20:45:54编辑过]