以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  SQLJoinTableBuilder  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=133921)

--  作者:北狐
--  发布时间:2019/4/23 15:56:00
--  SQLJoinTableBuilder
Dim StartDate As String = "04/01/2019" \'定义起始日期 Dim EndDate As String = "04/30/2019" \'定义结束日期
Dim TimeRange As String ="convert(nvarchar(10),smartDate,121)>=\'"& StartDate &"\' And convert(nvarchar(10),smartDate,121)<=\'"& EndDate &"\'" \'时间范围 " & TimeRange & " 
Dim filter As String="R05_RetailShipment_Detail.itemID Is null And R05_RetailShipment_Detail1.itemClassCode Is null" 
 \'销售单是否空单 
Dim jb1 As New SQLJoinTableBuilder("销售单检查","R05_RetailShipment") 

Jb1.ConnectionName = "龙域"

Jb1.AddTable("R05_RetailShipment","smartID","R05_RetailShipment_Detail","smartID")
Jb1.AddTable("R05_RetailShipment","smartID","R05_RetailShipment_Detail1","smartID")
Jb1.AddExp("本单单号","R05_RetailShipment.smartID") Jb1.AddExp("单内序号","\'null\'") 
Jb1.AddExp("物料编码","\'null\'") 
Jb1.AddExp("报错原因","\'空单\'") 
Jb1.Filter = ""& filter &"" 
jb1.Build() MainTable = Tables("销售单检查") 
Tables("销售单检查").visible = True 

SQLJoinTableBuilder怎么实现左连接,内连接查询不出数据

[此贴子已经被作者于2019/4/23 16:25:52编辑过]

--  作者:有点甜
--  发布时间:2019/4/23 16:06:00
--  

1、贴出的代码请好好排版;

 

2、请具体说明报什么错,有什么问题;

 

3、具体实例上传上来测试。


--  作者:北狐
--  发布时间:2019/4/23 16:24:00
--  
SQLJoinTableBuilder默认是内连接,怎么实现左连接,因为内连接查询不出数据
图片点击可在新窗口打开查看此主题相关图片如下:1556007703(1).png
图片点击可在新窗口打开查看

--  作者:北狐
--  发布时间:2019/4/23 17:05:00
--  
已解决
http://www.foxtable.com/webhelp/index.htm?page=2330.htm

--  作者:有点甜
--  发布时间:2019/4/23 17:28:00
--  

 

http://www.foxtable.com/webhelp/scr/2330.htm

 

 

 


--  作者:北狐
--  发布时间:2019/5/12 10:29:00
--  
Dim smartI As String = e.Form.Controls("smartI").Value  \'定义单号  (文本框控件)
Dim filter As String="((isnull(inboundQuantity,0)+isnull(outboundQuantity,0))<>0 and (isnull(inboundWageAmount,0)+isnull(outboundWageAmount,0))=0) or ((isnull(inboundWeight,0)+isnull(outboundWeight,0))<>0 and (isnull(inboundAmount,0)+isnull(outboundAmount,0))=0) or (R02_SilverStyle.materialCode=\'Au\' and (isnull(inboundQuantity,0)+isnull(outboundQuantity,0))<>0 and (isnull(inboundWageAmount,0)+isnull(outboundWageAmount,0))=0)"
\'成品快速存货核
Dim jb2 As New SQLJoinTableBuilder("成品存货核算异常表","R06_CheckMaterialAmount_Detail")
Jb2.C
Jb2.AddTable("R06_CheckMaterialAmount_Detail","smartID","R06_CheckMaterialAmount","smartID",JoinModeEnum.Left)
Jb2.AddTable("R06_CheckMaterialAmount_Detail","itemID","R02_SilverStyle","itemID",JoinModeEnum.Left)
Jb2.AddExp("单号","R06_CheckMaterialAmount.smartID")
Jb2.AddExp("序号","number")
Jb2.AddExp("物料编号","R06_CheckMaterialAmount_Detail.itemID")
Jb2.AddExp("工费","wage")
Jb2.Filter = "R06_CheckMaterialAmount.smartID =\'" & smartI & "\' and "& filter &""
Jb2.Order="number"
jb2.Build()
MainTable = Tables("成品存货核算异常表")
Tables("成品存货核算异常表").visible = True

以上代码,求老师看下为什么查询出来的数据没按smartI定义的单号过滤出来
如下代码时,过滤单号就有效
Jb2.Filter = "R06_CheckMaterialAmount.smartID =\'" & smartI & ""
[此贴子已经被作者于2019/5/12 17:08:31编辑过]

--  作者:有点甜
--  发布时间:2019/5/12 21:51:00
--  

改成下面这样测试,分别得到的结果,是否正确?

 

Jb2.Filter = "R06_CheckMaterialAmount.smartID =\'" & smartI & "\'"

 

Jb2.Filter = filter

[此贴子已经被作者于2019/5/12 21:55:46编辑过]

--  作者:北狐
--  发布时间:2019/5/13 10:18:00
--  
分别得到的结果是对的
[此贴子已经被作者于2019/5/13 10:24:18编辑过]

--  作者:有点甜
--  发布时间:2019/5/13 10:37:00
--  

改成

 

Jb2.Filter = "R06_CheckMaterialAmount.smartID = \'" & smartI & "\' and (" & filter & ")"


--  作者:北狐
--  发布时间:2019/5/13 10:43:00
--  
可以了,谢谢老师