以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  关于异表筛选的问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=87604)

--  作者:hongyefor
--  发布时间:2016/7/14 15:30:00
--  关于异表筛选的问题

比如我有一个订单表和一个订单明细表,相互没有关联,(订单表里有客户列,但是订单明细表里是没有客户列的)只是通过[_Identify]来取值。

现在我有一个查询窗口,有个ComboBox1,想按照客户筛选订单明细表的相关数据,请问怎么写这个代码啊


--  作者:大红袍
--  发布时间:2016/7/14 15:35:00
--  
 Dim idx1 As String = DataTables("主表").GetComboListString("_Identify“,”客户=’123‘“)
Tables("明细").Filter = "主表id in (\'" & idx1.Replace("|", "\',\'") & "\')"

--  作者:hongyefor
--  发布时间:2016/7/14 20:55:00
--  

Dim zw As WinForm.ComboBox = e.Form.Controls("ComboBox2")
Dim cj As WinForm.ComboBox = e.Form.Controls("ComboBox1")
Dim idx1 As String = DataTables("员工信息").GetComboListString("_Identify","客户= \'" & zw.Text & "\' and 公司 like \'%" & cj.Text & "%\'")
Tables("订单明细").Filter = "序号 In (\'" & idx1.Replace("|", "\',\'") & "\')"

 

 
图片点击可在新窗口打开查看此主题相关图片如下:cw.jpg
图片点击可在新窗口打开查看

 

如果[_Identify]不存在,就会出来错误,怎么解决呢?


[此贴子已经被作者于2016/7/14 20:56:56编辑过]

--  作者:大红袍
--  发布时间:2016/7/14 20:57:00
--  

这段代码没有问题。

 

应该是你currentChanged事件代码有问题,要加上没有记录的判断

 

If e.Table.Rows.Count = 0 Then return


--  作者:hongyefor
--  发布时间:2016/7/14 21:01:00
--  

SelectedIndexChanged里的判断怎么写啊


--  作者:大红袍
--  发布时间:2016/7/14 21:50:00
--  

筛选代码没有问题,肯定是你其它代码有错,看4楼。


--  作者:hongyefor
--  发布时间:2016/7/15 11:37:00
--  

 

[此贴子已经被作者于2016/7/15 11:40:18编辑过]