以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  查询表异常  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=184462)

--  作者:北狐
--  发布时间:2022/12/8 13:46:00
--  查询表异常
Dim Jb17 As New SQLJoinTableBuilder("应付初数据1", "R04_TransformProducts")
Jb17.C
Jb17.AddTable("{R04_TransformProducts_Detail}", "smartID", "R04_TransformProducts", "smartID", JoinModeEnum.Left)
Jb17.AddTable("{R04_TransformProducts_Detail}", "itemID", "R02_SilverStyle", "itemID", JoinModeEnum.Left)
Jb17.AddTable("{R04_TransformProducts_Detail}", "warehouseCode", "R02_Customer", "warehouseCode", JoinModeEnum.Left)
Jb17.AddExp("单据类型", "\'{R04_TransformProducts_Detail}\'")
Jb17.AddExp("类型", "\'领料重\'")
Jb17.AddExp("供应商代码", "R02_Customer.customerCode", True)
Jb17.AddExp("供应商名称", "R02_Customer.customerName", True)
Jb17.AddExp("本单日期", "convert(nvarchar(10),{R04_TransformProducts}.smartDate,121)", True)
Jb17.AddExp("系统单号", "{R04_TransformProducts}.smartID", True)
Jb17.AddExp("单内序号", "1")
Jb17.AddExp("工费单号", "{R04_TransformProducts}.smartID", True)
Jb17.AddExp("领料单号", "{R04_TransformProducts}.smartID", True)
Jb17.AddExp("产品成色", "\'\'")
Jb17.AddExp("比较成色", "R02_SilverStyle.materialName", True)
Jb17.AddExp("比较银重", "sum(isnull(weight,0)")
Jb17.AddExp("比较工费", "0 * 0.00001")
Jb17.AddExp("产品件数", "0")
Jb17.AddExp("产品净银重", "0 * 0.00001")
Jb17.AddExp("备注", "\'\'")
Jb17.AddExp("实领料成色", "R02_SilverStyle.materialName", True)
Jb17.AddExp("实领料银重", "sum(isnull(weight,0)")
Jb17.AddExp("实工费", "0 * 0.00001")
Jb17.Filter = "materialTypeCode=\'01\' and R02_Customer. customerCode=\'01.284\' And {R04_TransformProducts}.audited = \'true\' and convert(nvarchar(10),{R04_TransformProducts}.smartDate,121)>=\'2022-11-01\' And convert(nvarchar(10),{R04_TransformProducts}.smartDate,121)<=\'2022-11-30\'" 

jb17.Build
MainTable = Tables("应付初数据1")
Tables("应付初数据1").visible = True





以上代码报错如下,是否因为表名R04_TransformProducts_Detail中含有form(不是自建表,无法修改表名),老师帮看下能怎么样处理
.NET Framework 版本:4.0.30319.1026
Foxtable 版本:2022.8.18.1
错误所在事件:
详细错误信息:
\'R04_TransformProducts\' 附近有语法错误。
\',\' 附近有语法错误。
[此贴子已经被作者于2022/12/8 13:46:51编辑过]

--  作者:有点蓝
--  发布时间:2022/12/8 13:59:00
--  
请上传实例测试
--  作者:北狐
--  发布时间:2022/12/8 14:16:00
--  
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目1.table


老师这是实例

[此贴子已经被作者于2022/12/8 14:16:36编辑过]

--  作者:有点蓝
--  发布时间:2022/12/8 14:19:00
--  
连接不了数据库无法测试。导入相关表数据到access发上来
--  作者:北狐
--  发布时间:2022/12/9 10:23:00
--  
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目1.table


老师,相关已经放进去了
[此贴子已经被作者于2022/12/9 10:23:54编辑过]

--  作者:有点蓝
--  发布时间:2022/12/9 10:50:00
--  
Dim Jb17 As New SQLJoinTableBuilder("应付初数据1", "R04_TransformProducts_Detail")
Jb17.C
AddTable的表名不需要加大括号
Jb17.AddTable("R04_TransformProducts_Detail", "smartID", "R04_TransformProducts", "smartID", JoinModeEnum.Left)
Jb17.AddTable("R04_TransformProducts_Detail", "itemID", "R02_SilverStyle", "itemID", JoinModeEnum.Left)
Jb17.AddTable("R04_TransformProducts_Detail", "warehouseCode", "R02_Customer", "warehouseCode", JoinModeEnum.Left)
Jb17.AddExp("供应商代码", "{R02_Customer}.customerCode", True)
Jb17.AddExp("供应商名称", "{R02_Customer}.customerName", True)
Jb17.AddExp("本单日期", "convert(nvarchar(10),{R04_TransformProducts}.smartDate,121)", True)
Jb17.AddExp("系统单号", "{R04_TransformProducts}.smartID", True)
Jb17.AddExp("工费单号", "{R04_TransformProducts}.smartID", True)
Jb17.AddExp("领料单号", "{R04_TransformProducts}.smartID", True)
Jb17.AddExp("比较成色", "{R02_SilverStyle}.materialName", True)
Jb17.AddExp("实领料成色", "{R02_SilverStyle}.materialName", True)

\'Jb17.AddExp("单据类型", "{R04_TransformProducts_Detail}.")没有指定列名
\'Jb17.AddExp("类型", "领料重")不存在这些列
Jb17.AddExp("单内序号", "1")
Jb17.AddExp("产品成色", "\'\'")
Jb17.AddExp("比较银重", "sum(isnull(weight,0))")少括号
Jb17.AddExp("比较工费", "0 * 0.00001")
Jb17.AddExp("产品件数", "0")
Jb17.AddExp("产品净银重", "0 * 0.00001")
Jb17.AddExp("备注", "\'\'")
Jb17.AddExp("实领料银重", "sum(isnull(weight,0))")少括号
Jb17.AddExp("实工费", "0 * 0.00001")
Jb17.Filter = "{R02_SilverStyle}.materialTypeCode=\'01\' and R02_Customer. customerCode=\'01.284\' And {R04_TransformProducts}.audited = \'true\' and convert(nvarchar(10),{R04_TransformProducts}.smartDate,121)>=\'2022-11-01\' And convert(nvarchar(10),{R04_TransformProducts}.smartDate,121)<=\'2022-11-30\'" 
jb17.Build
MainTable = Tables("应付初数据1")
Tables("应付初数据1").visible = True