以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]字符串“”到类型DATE的转换无效  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=91283)

--  作者:13388123666
--  发布时间:2016/10/6 16:46:00
--  [求助]字符串“”到类型DATE的转换无效
Dim Customer As WinForm.ComboBox = e.Form.Controls("客户代码")
Dim StartDate As WinForm.DateTimePicker = e.Form.Controls("开始日期")
Dim EndDate As WinForm.DateTimePicker = e.Form.Controls("结束日期")
Dim bd1 As New SQLGroupTableBuilder("统计表1","工序完工明细")
bd1.C
Dim dt1 As fxDataSource
bd1.Groups.AddDef("产品代码") 
bd1.Totals.AddExp("制壳重量","case when 工序 = \'制壳\' then 数量 * 组件数*单件重量 else 0 end") \'对制壳重量进行统计
bd1.Totals.AddExp("浇注重量","case when 工序 = \'浇注\' then 数量 * 组件数*单件重量 else 0 end") \'对浇注重量进行统计
If StartDate.Value <> "" And EndDate.Value <> "" Then
    If Customer.Value = "" Then
        bd1.Filter = "日期 >=  \'" & StartDate.Value & "\' And 日期 <= \'" & EndDate.Value & "\'"
    Else
        bd1.Filter = "SubString(产品代码,1,3) = \'" & Customer.Value & "\' And 日期 >= \'" & StartDate.Value & "\' And 日期 <= \'" & EndDate.Value & "\'"
    End If
Else
    If Customer.Value = "" Then
        bd1.Filter = ""
    Else
        bd1.Filter = "SubString(产品代码,1,3) = \'" & Customer.Value & "\'"
    End If
End If
dt1 = bd1.BuildDataSource()

按时间段进行统计的时候,上述代码在执行的时候,提示转换无效,尝试把DateTimePicker改成TextBox,可以执行,但输入时间的时候不方便,请教该如何修改上述代码?谢谢!

--  作者:有点蓝
--  发布时间:2016/10/6 16:52:00
--  
If StartDate.Value isnot nothing And EndDate.Value isnot nothing Then