以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  这个是什么梗?  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=150917)

--  作者:ygg8310
--  发布时间:2020/6/10 21:45:00
--  这个是什么梗?
For Each s As String In DataTables("表B").GetValues("品名|产品")
    Dim cnt As Integer = DataTables("表B").Compute("count(*)","品名=\'" & s & "\' And 产品=\'" & s & "\'")
    DataTables("表B").ReplaceFor("数量",cnt,"品名=\'" & s & "\' And 产品=\'" & s & "\'")
Next
无效,求助错在哪里

--  作者:xongyijd
--  发布时间:2020/6/10 23:49:00
--  
For Each s As String() In DataTables("表B").GetValues("品名|产品")
    Dim cnt As Integer = DataTables("表B").Compute("count(*)","品名=\'" & s(0) & "\' And 产品=\'" & s(1) & "\'")
    DataTables("表B").ReplaceFor("数量",cnt,"品名=\'" & s(0) & "\' And 产品=\'" & s(1) & "\'")
Next
[此贴子已经被作者于2020/6/10 23:53:17编辑过]

--  作者:有点蓝
--  发布时间:2020/6/11 8:42:00
--  
帮助不熟,估计出错后也不会去查查帮助看看GetValues的用法
--  作者:ygg8310
--  发布时间:2020/6/11 10:56:00
--  
GetValues("品名|产品")
这个没错呀
应该是
.Compute("count(*)","品名=\'" & s(0) & "\' And 产品=\'" & s(1) & "\'")
还有
ReplaceFor("数量",cnt,"品名=\'" & s(0) & "\' And 产品=\'" & s(1) & "\'")
错了