以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]动态列表  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=139194)

--  作者:lgj716330
--  发布时间:2019/8/7 22:34:00
--  [求助]动态列表
Dim cmb As WinForm.CheckedComboBox = e.Sender
Dim str11 As String = e.Form.Controls("ZZ").value 
Dim str12 As String = e.Form.Controls("DP").value 
Dim str21 As String = e.Form.Controls("ZZFL").value 
Dim str22 As String = e.Form.Controls("DPFL").value 
If str11 IsNot Nothing And str12 IsNot Nothing Then
cmb.ComboList = DataTables("店铺档案").GetComboListString("部门名称", "\'" & str21 & "\' in ( \'" & str11.replace(",","\',\'") & "\') and \'" & str22 & "\' in ( \'" & str12.replace(",","\',\'") & "\')")
ElseIf str11 Is Nothing And str12 IsNot Nothing Then
cmb.ComboList = DataTables("店铺档案").GetComboListString("部门名称", "\'" & str22 & "\' in ( \'" & str12.replace(",","\',\'") & "\')")
ElseIf str11 IsNot Nothing And str12 Is Nothing Then
cmb.ComboList = DataTables("店铺档案").GetComboListString("部门名称", "\'" & str21 & "\' in ( \'" & str11.replace(",","\',\'") & "\')")
Else
cmb.ComboList = DataTables("店铺档案").GetComboListString("部门名称")
End If

图片点击可在新窗口打开查看此主题相关图片如下:qq图片20190807222617.png
图片点击可在新窗口打开查看
上面的DPMX控件根据ZZ和DP控件联动,ZZ控件根据ZZFL联动,DP控件根据DPFL联动,发现只有ZZ和DP都不选的时候DPMX才有,其他情况DPMX都是空的,其中ZZFL是列名,ZZ是列的内容,DPFL是列名,DP是列的内容,我这代码哪里有问题

[此贴子已经被作者于2019/8/7 22:36:23编辑过]

--  作者:有点蓝
--  发布时间:2019/8/8 9:31:00
--  
列名不需要使用单引号引起来,否则就是普通的字符串而不是列名了

cmb.ComboList = DataTables("店铺档案").GetComboListString("部门名称", str21 & " In ( \'" & str11.replace(",","\',\'") & "\') and " & str22 & " in ( \'" & str12.replace(",","\',\'") & "\')")