以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 筛选 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=102450) |
-- 作者:等待 -- 发布时间:2017/6/20 10:37:00 -- 筛选
表A中第三列,包含李四的有2行,不包含李四的有5行, 能不能在一个窗口的TextBox控件中显示 “2,5” 代码是什么 |
-- 作者:有点色 -- 发布时间:2017/6/20 10:41:00 -- Dim name As String = "李四" Dim count1 as integer = DataTables("表A").Compute("count(_Identify)", "第三列 = \'" & name & "\'") Dim count2 as integer = DataTables("表A").Compute("count(_Identify)", "") Forms("窗口1").Controls("TextBox1").Text = count1 & "," & (count2-count1) [此贴子已经被作者于2017/6/20 11:02:55编辑过]
|
-- 作者:等待 -- 发布时间:2017/6/20 10:54:00 -- 在同一个窗口中再增加一个TextBox控件对表B中的第三列进行同样的操作,代码怎么写 |
-- 作者:有点色 -- 发布时间:2017/6/20 11:03:00 -- Dim name As String = "李四" Dim count1 As Integer = DataTables("表A").Compute("count(_Identify)", "第三列 = \'" & name & "\'") Dim count2 As Integer = DataTables("表A").Compute("count(_Identify)", "") Forms("窗口1").Controls("TextBox1").Text = count1 & "," & (count2-count1) name = "李四" count1 = DataTables("表B").Compute("count(_Identify)", "第三列 = \'" & name & "\'") count2 = DataTables("表B").Compute("count(_Identify)", "") Forms("窗口1").Controls("TextBox2").Text = count1 & "," & (count2-count1) |
-- 作者:等待 -- 发布时间:2017/6/20 12:21:00 -- 再对表A,表B加上日期筛选 这样的查询结果 代码怎么写 |
-- 作者:有点色 -- 发布时间:2017/6/20 14:24:00 -- Dim name As String = "李四" Dim d As Date = "2017-06-20" Dim count1 As Integer = DataTables("表A").Compute("count(_Identify)", "第三列 = \'" & name & "\' and 日期 = #" & d & "#") Dim count2 As Integer = DataTables("表A").Compute("count(_Identify)", "日期 = #" & d & "#") Forms("窗口1").Controls("TextBox1").Text = count1 & "," & (count2-count1) name = "李四" count1 = DataTables("表B").Compute("count(_Identify)", "第三列 = \'" & name & "\' and 日期 = #" & d & "#") count2 = DataTables("表B").Compute("count(_Identify)", "日期 = #" & d & "#") Forms("窗口1").Controls("TextBox2").Text = count1 & "," & (count2-count1) |
-- 作者:等待 -- 发布时间:2017/6/20 15:44:00 -- 表A中有日期起止时间的筛选,当输入日期时,加载的行数变了,但执行上面代码所出来结果不变化 |
-- 作者:有点色 -- 发布时间:2017/6/20 15:51:00 -- 你把DataTables改成Tables就可以了。 |