以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助] 红色部分的代码怎么写??统计字段为变量!  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=60589)

--  作者:lmlptj
--  发布时间:2014/11/27 15:32:00
--  [求助] 红色部分的代码怎么写??统计字段为变量!

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




Dim TP As WinForm.TopicBar = e.Form.Controls("TopicBar1")
For Each  FLL As WinForm.TopicPage In TP.Pages
    FLL.Links.Clear
    For Each ZWDJ As String In DataTables("词典").GetComboListString("名称","类别 = \'" & FLL.Name & "\'","_Identify").Split("|")
        Dim KG As String = NEW String(" ",24 - ZWDJ.Length*2)
        Dim RS As String = DataTables("人员表").Compute("count(身份号)", " & FLL.Name &  = "\'" & ZWDJ & "\'")
        FLL.Links.Add(ZWDJ,ZWDJ)\' & KG & RS)
    Next
Next


请问红色部分的代码怎么写??
变量 FLL.Name  是《人员表》中的一字段!!!  
运行过程中出现   " & "操作符前缺少操作符!

--  作者:有点甜
--  发布时间:2014/11/27 15:41:00
--  

 你msgbox看一下

 

msgbox(FLL.Name)

 

msgbox(FLL.Text)


--  作者:lmlptj
--  发布时间:2014/11/27 15:54:00
--  
Dim TP As WinForm.TopicBar = e.Form.Controls("TopicBar1")
For Each  FLL As WinForm.TopicPage In TP.Pages
    FLL.Links.Clear
    For Each ZWDJ As String In DataTables("词典").GetComboListString("名称","类别 = \'" & FLL.Name & "\'","_Identify").Split("|")
        Dim KG As String = NEW String(" ",24 - ZWDJ.Length*2)
        Dim EXP As String = CEXP("{0} = {1}",FLL.Name,ZWDJ)
        Dim RS As String = DataTables("人员表").Compute("count(_Identify)",EXP)
\'        MessageBox.Show(EXP)
\'        MessageBox.Show("统计字段为:" & FLL.Name & "     值为:" & ZWDJ)
        
                FLL.Links.Add(ZWDJ,ZWDJ & KG & RS)\' & KG & RS)
    Next
Next


我后来改成这样的代码,显示信息的时候都是对的,但在执行的时候却遇到"***"不是统计表中的列!图片点击可在新窗口打开查看

--  作者:有点甜
--  发布时间:2014/11/27 15:56:00
--  

 是不是要加单引号啊?

 

CEXP("{0} = \'{1}\'",FLL.Name,ZWDJ)


--  作者:lmlptj
--  发布时间:2014/11/27 16:02:00
--  
Dim TP As WinForm.TopicBar = e.Form.Controls("TopicBar1")
For Each  FLL As WinForm.TopicPage In TP.Pages
    FLL.Links.Clear
    For Each ZWDJ As String In DataTables("词典").GetComboListString("名称","类别 = \'" & FLL.Name & "\'","_Identify").Split("|")
        Dim KG As String = NEW String(" ",24 - ZWDJ.Length*2)
        Dim EXP As String = CEXP("{0} = \'{1}\'",FLL.Name,ZWDJ)
        Dim RS As String = DataTables("人员表").Compute("count(_Identify)",EXP)
        FLL.Links.Add(ZWDJ,ZWDJ & KG & RS)\' & KG & RS)
    Next
Next


终于搞定!!

--  作者:lmlptj
--  发布时间:2014/11/27 17:00:00
--  
灰常感谢!