为什么两种不同方法不能达到同样的结果?

yyuuu2003 2017-04-26 08:38:45
各位老师好,很久不来了,你们还好吗?
我现在遇到一个问题就是,我用下列方法,执行后有一个数字会显示在表单画面,后一种不显示,这两种有什么不同吗?
public tian,lings,shils
tian=thisform.text7.value
*select jjgz
select jjgz.rybh,jjgz.riqi,jjgz.ling from jjgz;
DISTINCT where ;
jjgz.rybh=thisform.combo3.value;
and year(jjgz.riqi)=thisform.text5.value;
and month(jjgz.riqi)=thisform.text6.value;
and jjgz.ling<>0;
into cursor lingtemp
select lingtemp
sum ling to lings for ling>0 and ling<1 or ling=1 用这一句表单中出现LINGS的结果数字'9'
*count to lings 不用上句用这句代替就不出现'9',请问各位这两种方法有不同的效果?我是不希望显示'9'




report form jjgz for jjgz.rybh=thisform.combo3.value and;
year(jjgz.riqi)=thisform.text5.value;
and month(jjgz.riqi)=thisform.text6.value;
PREVIEW
...全文
544 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
yyuuu2003 2017-04-27
  • 打赏
  • 举报
回复
我现在的语言是这样的(如果是这样的话,要在表单价那设成SET TALK OFF才不显示所得的结果: public tian,lings,shils tian=thisform.text7.value select jjgz.rybh,jjgz.riqi,jjgz.ling from jjgz; DISTINCT where ; jjgz.rybh=thisform.combo3.value; and year(jjgz.riqi)=thisform.text5.value; and month(jjgz.riqi)=thisform.text6.value; and jjgz.ling<>0; into cursor lingtemp select lingtemp sum ling for ling>0 and ling<1 or ling=1 to x count for ling>1 to y lings=x+y select jjgz.rybh,jjgz.riqi,jjgz.shil from jjgz; DISTINCT where ; jjgz.rybh=thisform.combo3.value; and year(jjgz.riqi)=thisform.text5.value; and month(jjgz.riqi)=thisform.text6.value; and jjgz.shil<>0; into cursor shiltemp select shiltemp sum shil for shil>0 and shil<1 or shil=1 to x1 count for shil>1 to y1 shils=x1+y1 以往用下面这语言(用这段语言表单不用SET TALK OFF,也不用SET TALK ON表单都不会出现所统计的数据) public tian,lings,shils[code=php] tian=thisform.text7.value select jjgz.rybh,jjgz.riqi,jjgz.ling from jjgz; DISTINCT where ; jjgz.rybh=thisform.combo3.value; and year(jjgz.riqi)=thisform.text5.value; and month(jjgz.riqi)=thisform.text6.value; and jjgz.ling<>0; into cursor lingtemp select lingtemp count to lings select jjgz.rybh,jjgz.riqi from jjgz; DISTINCT where ; jjgz.rybh=thisform.combo3.value; and year(jjgz.riqi)=thisform.text5.value; and month(jjgz.riqi)=thisform.text6.value; and jjgz.shil<>0; into cursor shiltemp select jjgz.rybh,jjgz.riqi,jjgz.shil from jjgz; DISTINCT where ; jjgz.rybh=thisform.combo3.value; and year(jjgz.riqi)=thisform.text5.value; and month(jjgz.riqi)=thisform.text6.value; and jjgz.shil<>0; into cursor shiltemp select shiltemp count to shils
十豆三 2017-04-26
  • 打赏
  • 举报
回复
你说反了吧 VFP自带帮助文件中是这样说的 COUNT 计算使 FOR 或 WHILE 条件为真的、一定范围的记录. 如果 SET TALK 为 ON,将显示记录数。 没有为什么,因为这2个是不同的命令,Sum是求和,Count是求数。
yyuuu2003 2017-04-26
  • 打赏
  • 举报
回复
忘记传显示的图了:
yyuuu2003 2017-04-26
  • 打赏
  • 举报
回复
这个我知道,但我就是想知道为什么这两种方法不同?且以往我这样弄的程序好象没出现过这种情况
xuzuning 2017-04-26
  • 打赏
  • 举报
回复
set talk off

2,723

社区成员

发帖
与我相关
我的任务
社区描述
VFP,是Microsoft公司推出的数据库开发软件,用它来开发数据库,既简单又方便。
社区管理员
  • VFP社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧