以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  难道不能直接使用as后的名作为列名?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=118759)

--  作者:yetle
--  发布时间:2018/5/10 14:20:00
--  难道不能直接使用as后的名作为列名?
查询表
select C.InDate AS 制单日期 , a.MakeGro as 生产班组,a.Gyno as 物供号,a.OrderNo as 订单号,a.ClientStyle as 客款号,a.Ftyno as 厂号,a.Goodsxl as 系列名,a.ZDNO 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 订单合计 f rom   PQ_Main a Left join PQ_Size_Color_Num b on a.OrderNo=b.OrderNo left join PQ_OutID C ON A.ZDID=C.ZDID ORDER BY a.Goodsxl
筛选时间数据
Dim stade As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker1")
Dim Endde As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker2")


Dim dt As DataTable=DataTables("dbscmx")
Dim filter As String = "1=1"


If stade.text >"" Then

     filter= filter & " and [制单日期]>=\'" & stade.text & "\'"
Else
    MessageBox.show("请选择开始日期!")
    Return
End If

If  Endde.text>"" Then

    filter=filter & " and [制单日期] <= \'" & Endde.text & "\'"

Else
    MessageBox.show("请选择结束日期!")
Return
End If
dt.LoadFilter=filter
dt.Load()



弹出提示:

.NET Framework 版本:2.0.50727.3655
Foxtable 版本:2018.3.9.1
错误所在事件:加载[dbscmx]失败!
详细错误信息:
列名 \'制单日期\' 无效。
列名 \'制单日期\' 无效。

[此贴子已经被作者于2018/5/10 14:28:33编辑过]

--  作者:有点甜
--  发布时间:2018/5/10 14:28:00
--  

对于查询表,不能直接写loadfilter、load的。你只能筛选,比如 Tables("").Filter = ""

 

查询表如果要loadfilter,必须写其本来的列名,如 C.InDate 等。