在sql 管理器查询数据正常,放在sql查询表也正常,但进行筛选和取消筛选的时候提示sql语句语法错误,sql语句如下:
select a.WorkNo AS 车间,a.Outdate as 货期 ,E.Goods as 类别 , A.InDate AS 制单日期 , E.MakeGro as 生产班组,E.Gyno as 物供号,e.ClientOrderno AS 批次号,e.OrderNo as 订单号,
E.ClientStyle as 客款号,a.Ftyno as 厂号,a.Goodsxl as 系列名,A.DJNO as 制单号,b.color as 颜色,b.SizeBi as 杯型,b.size2 as S_70,b.size3 as M_75,b.size4 as L_80,b.size5 as XL_85,b.size6 as XXL_90,
(isnull(b.size2,0)+isnull(b.size3,0)+isnull(b.size4,0)+isnull(b.size5,0)+isnull(b.size6,0)) as 订单合计,
ISNULL(g.insize1,0)+ISNULL(g.insize2,0)+ISNULL(g.insize3,0)+ISNULL(g.insize4,0)+ISNULL(g.insize5,0)+ISNULL(g.insize6,0) as 入库,
ISNULL(d.outsize1,0)+ISNULL(d.outsize2,0)+ISNULL(d.outsize3,0)+ISNULL(d.outsize4,0)+ISNULL(d.outsize5,0)+ISNULL(d.outsize6,0) as 发货
f rom PQ_OutID A Left join PQ_Out_List b on A.OUTID=B.UPID left join pq_main E ON B.Orderno=E.OrderNo left join PQ_Size_Color_Num F on E.id=F.upid left join BAI_FTYNO V ON E.Ftyno=V.Ftyno
left join (select Orderno, ftyno,color,SizeBi,
sum(case when inout=2 then isnull(Size1,0) else 0 end) as outsize1,
sum(case when inout=2 then isnull(Size2,0) else 0 end) as outsize2,
sum(case when inout=2 then isnull(Size3,0) else 0 end) as outsize3,
sum(case when inout=2 then isnull(Size4,0) else 0 end) as outsize4,
sum(case when inout=2 then isnull(Size5,0) else 0 end) as outsize5,
sum(case when inout=2 then isnull(Size6,0) else 0 end) as outsize6
f rom Goods_SizeGroup_List group by Orderno,ftyno,color,SizeBi) d on LTRIM(RTRIM(f.orderno))=LTRIM(RTRIM(d.orderno)) and LTRIM(RTRIM(f.ftyno))=LTRIM(RTRIM(d.ftyno)) and LTRIM(RTRIM(f.color))=LTRIM(RTRIM(d.color)) and ISNULL(f.sizebi,'')=ISNULL(d.sizebi,'')
left join (select Orderno, ftyno,color,SizeBi,
sum(case when inout=1 then isnull(Size1,0) else 0 end) as insize1,
sum(case when inout=1 then isnull(Size2,0) else 0 end) as insize2,
sum(case when inout=1 then isnull(Size3,0) else 0 end) as insize3,
sum(case when inout=1 then isnull(Size4,0) else 0 end) as insize4,
sum(case when inout=1 then isnull(Size5,0) else 0 end) as insize5,
sum(case when inout=1 then isnull(Size6,0) else 0 end) as insize6
f rom Goods_SizeGroup_List group by Orderno,ftyno,color,SizeBi) g on LTRIM(RTRIM(f.orderno))=LTRIM(RTRIM(g.orderno)) and LTRIM(RTRIM(f.ftyno))=LTRIM(RTRIM(g.ftyno)) and LTRIM(RTRIM(f.color))=LTRIM(RTRIM(g.color)) and ISNULL(f.sizebi,'')=ISNULL(g.sizebi,'')
where A.InDate>'2017-06-01'
取消筛选语句:(提示错误:'Goods_SizeGroup_List' 附近有语法错误。)
DataTables("dbscmx").LoadFilter=""
DataTables("dbscmx").Load()
Tables("dbscmx").Filter=""
筛选语句:(')' 附近有语法错误。)
Dim stade As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker1")
Dim Endde As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker2")
'Dim pd01 As WinForm.ComboBox = e.Form.Controls("ComboBox2")
Dim cs01 As WinForm.ComboBox = e.Form.Controls("ComboBox1")
Dim cs02 As WinForm.ComboBox = e.Form.Controls("ComboBox2")
Dim cs03 As WinForm.ComboBox = e.Form.Controls("ComboBox3")
Dim cs04 As WinForm.ComboBox = e.Form.Controls("ComboBox4")
Dim dt As DataTable=DataTables("dbscmx")
Dim filter As String = "1=1"
With e.Form.Controls("DateTimePicker1")
If .Value IsNot Nothing Then
If stade.text >"" Then
Filter = Filter & " And "
End If
' filter= filter & " and a.InDate >='" & stade.text & "'"
filter= filter & "a.InDate >='" & stade.text & "'"
End If
End With
With e.Form.Controls("DateTimePicker2")
If .Value IsNot Nothing Then
If Endde.text>"" Then
Filter = Filter & " And "
End If
filter=filter & "a.InDate <= '" & Endde.text & "'"
End If
End With
With e.Form.Controls("ComboBox1")
If .Value IsNot Nothing Then
If cs01.text>"" Then
Filter = Filter & " And "
End If
filter=filter & "E.Gyno = '" & cs01.text & "'"
End If
End With
With e.Form.Controls("ComboBox2")
If .Value IsNot Nothing Then
If cs02.text>"" Then
Filter = Filter & " And "
End If
filter=filter & "E.Goods = '" & cs02.text & "'"
End If
End With
With e.Form.Controls("ComboBox3")
If .Value IsNot Nothing Then
If cs03.text>"" Then
Filter = Filter & " And "
End If
filter=filter & "a.Ftyno = '" & cs03.text & "'"
End If
End With
With e.Form.Controls("ComboBox4")
If .Value IsNot Nothing Then
If cs04.text>"" Then
Filter = Filter & " And "
End If
filter=filter & "E.ClientStyle = '" & cs04.text & "'"
End If
End With
If Filter > "" Then
dt.LoadFilter=filter
dt.Load()
End If