| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 933 人关注过本帖
标题:这个是什么原因?
只看楼主 加入收藏
fdqzy
Rank: 1
等 级:新手上路
帖 子:368
专家分:0
注 册:2016-8-15
结帖率:73.97%
收藏
已结贴  问题点数:20 回复次数:7 
这个是什么原因?
程序代码:
USE fc\szpt IN 0 ALIAS t1 AGAIN
USE fc\szpt IN 0 ALIAS t2 AGAIN  
SELECT t1
SET RELATION TO RECNO()+1 INTO "t2"
SELECT t1
       REPLACE ALL;
               t2.b5y1 WITH IIF(t1.a1+5=t2.a1  OR ;
                              t1.a1+5=t2.a2  OR ;
                              t1.a1+5=t2.a3  OR ;
                              t1.a1+5=t2.a4  OR ;
                              t1.a1+5=t2.a5  OR ;
                              t1.a1+5=t2.a6 ,'B5Y1',"");
               t2.b5y2 WITH IIF(t1.a2+5=t2.a1  OR ;
                              t1.a2+5=t2.a2  OR ;
                              t1.a2+5=t2.a3  OR ;
                              t1.a2+5=t2.a4  OR ;
                              t1.a2+5=t2.a5  OR ;
                              t1.a2+5=t2.a6 ,'B5Y2',"");
               t2.b5y3 WITH IIF(t1.a3+5=t2.a1  OR ;
                              t1.a3+5=t2.a2  OR ;
                              t1.a3+5=t2.a3  OR ;
                              t1.a3+5=t2.a4  OR ;
                              t1.a3+5=t2.a5  OR ;
                              t1.a3+5=t2.a6 ,'B5Y2',"")         
               *t2.b5y4 WITH IIF(t1.34+5=t2.a1  OR ;
                              t1.a4+5=t2.a2  OR ;
                              t1.a4+5=t2.a3  OR ;
                              t1.a4+5=t2.a4  OR ;
                              t1.a4+5=t2.a5  OR ;
                              t1.a4+5=t2.a6 ,'B5Y4',"");
              t2.b5y5 WITH IIF(t1.a5+5=t2.a1 OR ;
                              t1.a5+5=t2.a2 OR ;
                              t1.a5+5=t2.a3 OR ;
                              t1.a5+5=t2.a4 OR ;
                              t1.a5+5=t2.a5 OR ;
                              t1.a5+5=t2.a6 ,'B5Y5',"");
               t2.b5y6 WITH IIF(t1.a6+5=t2.a1 OR ;
                              t1.a6+5=t2.a2 OR ;
                              t1.a6+5=t2.a3 OR ;
                              t1.a6+5=t2.a4 OR ;
                              t1.a6+5=t2.a5 OR ;
                              t1.a6+5=t2.a6 ,'B5Y6',"");                                                                                  
               t2.b5z1 WITH IIF(t1.a1-5=t2.a1 OR ;
                              t1.a1-5=t2.a2  OR ;
                              t1.a1-5=t2.a3  OR ;
                              t1.a1-5=t2.a4  OR ;
                              t1.a1-5=t2.a5  OR ;
                              t1.a1-5=t2.a6,'B5Z1',"");
              t2.b5z2 WITH IIF(t1.a2-5=t2.a1 OR ;
                              t1.a2-5=t2.a2  OR ;
                              t1.a2-5=t2.a3  OR ;
                              t1.a2-5=t2.a4  OR ;
                              t1.a2-5=t2.a5  OR ;
                              t1.a2-5=t2.a6 ,'B5Z1',"");
              t2.b5z3 WITH IIF(t1.a3-5=t2.a1 OR ;
                              t1.a3-5=t2.a2  OR ;
                              t1.a3-5=t2.a3  OR ;
                              t1.a3-5=t2.a4  OR ;
                              t1.a3-5=t2.a5  OR ;
                              t1.a3-5=t2.a6 ,'B5Z1',"");
              t2.b5z4 WITH IIF(t1.a4-5=t2.a1 OR ;
                              t1.a4-5=t2.a2  OR ;
                              t1.a4-5=t2.a3  OR ;
                              t1.a4-5=t2.a4  OR ;
                              t1.a4-5=t2.a5  OR ;
                              t1.a4-5=t2.a6 ,'B5Z1',"");
               t2.b5z5 WITH IIF(t1.a5-5=t2.a1 OR ;
                              t1.a5-5=t2.a2  OR ;
                              t1.a5-5=t2.a3  OR ;
                              t1.a5-5=t2.a4  OR ;
                              t1.a5-5=t2.a5  OR ;
                              t1.a5-5=t2.a6 ,'B5Z1',"");
               t2.b5z6 WITH IIF(t1.a6-5=t2.a1 OR ;
                              t1.a6-5=t2.a2  OR ;
                              t1.a6-5=t2.a3  OR ;
                              t1.a6-5=t2.a4  OR ;
                              t1.a6-5=t2.a5  OR ;
                              t1.a6-5=t2.a6 ,'B5Z1',"") 
SET RELATION TO

在使用REPLACE ALL时,行“*”以上保存正常,再增加一行代码,点“保存时”报“语法错误”。
是什么原因?
以前在使用REPLACE ALL时,行不超过200。
搜索更多相关主题的帖子: SET 原因 WITH REPLACE SELECT 
2021-08-06 10:02
sdta
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:江苏省连云港市
等 级:版主
威 望:335
帖 子:9841
专家分:27213
注 册:2012-2-5
收藏
得分:20 
SELECT t1
       REPLACE ALL;
               t2.b5y1 WITH IIF(t1.a1+5=t2.a1  OR ;
                              t1.a1+5=t2.a2  OR ;
                              t1.a1+5=t2.a3  OR ;
                              t1.a1+5=t2.a4  OR ;
                              t1.a1+5=t2.a5  OR ;
                              t1.a1+5=t2.a6 ,'B5Y1',""),;
               t2.b5y2 WITH IIF(t1.a2+5=t2.a1  OR ;
                              t1.a2+5=t2.a2  OR ;
                              t1.a2+5=t2.a3  OR ;
                              t1.a2+5=t2.a4  OR ;
                              t1.a2+5=t2.a5  OR ;
                              t1.a2+5=t2.a6 ,'B5Y2',""),;
               t2.b5y3 WITH IIF(t1.a3+5=t2.a1  OR ;
                              t1.a3+5=t2.a2  OR ;
                              t1.a3+5=t2.a3  OR ;
                              t1.a3+5=t2.a4  OR ;
                              t1.a3+5=t2.a5  OR ;
                              t1.a3+5=t2.a6 ,'B5Y2',""),;         
               *t2.b5y4 WITH IIF(t1.34+5=t2.a1  OR ;
                              t1.a4+5=t2.a2  OR ;
                              t1.a4+5=t2.a3  OR ;
                              t1.a4+5=t2.a4  OR ;
                              t1.a4+5=t2.a5  OR ;
                              t1.a4+5=t2.a6 ,'B5Y4',""),;
              t2.b5y5 WITH IIF(t1.a5+5=t2.a1 OR ;
                              t1.a5+5=t2.a2 OR ;
                              t1.a5+5=t2.a3 OR ;
                              t1.a5+5=t2.a4 OR ;
                              t1.a5+5=t2.a5 OR ;
                              t1.a5+5=t2.a6 ,'B5Y5',""),;
               t2.b5y6 WITH IIF(t1.a6+5=t2.a1 OR ;
                              t1.a6+5=t2.a2 OR ;
                              t1.a6+5=t2.a3 OR ;
                              t1.a6+5=t2.a4 OR ;
                              t1.a6+5=t2.a5 OR ;
                              t1.a6+5=t2.a6 ,'B5Y6',""),;                                                                                 
               t2.b5z1 WITH IIF(t1.a1-5=t2.a1 OR ;
                              t1.a1-5=t2.a2  OR ;
                              t1.a1-5=t2.a3  OR ;
                              t1.a1-5=t2.a4  OR ;
                              t1.a1-5=t2.a5  OR ;
                              t1.a1-5=t2.a6,'B5Z1',"");
              t2.b5z2 WITH IIF(t1.a2-5=t2.a1 OR ;
                              t1.a2-5=t2.a2  OR ;
                              t1.a2-5=t2.a3  OR ;
                              t1.a2-5=t2.a4  OR ;
                              t1.a2-5=t2.a5  OR ;
                              t1.a2-5=t2.a6 ,'B5Z1',""),;
              t2.b5z3 WITH IIF(t1.a3-5=t2.a1 OR ;
                              t1.a3-5=t2.a2  OR ;
                              t1.a3-5=t2.a3  OR ;
                              t1.a3-5=t2.a4  OR ;
                              t1.a3-5=t2.a5  OR ;
                              t1.a3-5=t2.a6 ,'B5Z1',""),;
              t2.b5z4 WITH IIF(t1.a4-5=t2.a1 OR ;
                              t1.a4-5=t2.a2  OR ;
                              t1.a4-5=t2.a3  OR ;
                              t1.a4-5=t2.a4  OR ;
                              t1.a4-5=t2.a5  OR ;
                              t1.a4-5=t2.a6 ,'B5Z1',"");
               t2.b5z5 WITH IIF(t1.a5-5=t2.a1 OR ;
                              t1.a5-5=t2.a2  OR ;
                              t1.a5-5=t2.a3  OR ;
                              t1.a5-5=t2.a4  OR ;
                              t1.a5-5=t2.a5  OR ;
                              t1.a5-5=t2.a6 ,'B5Z1',""),;
               t2.b5z6 WITH IIF(t1.a6-5=t2.a1 OR ;
                              t1.a6-5=t2.a2  OR ;
                              t1.a6-5=t2.a3  OR ;
                              t1.a6-5=t2.a4  OR ;
                              t1.a6-5=t2.a5  OR ;
                              t1.a6-5=t2.a6 ,'B5Z1',"")

代码中缺少,;,低级错误啊
IIF(t1.a1+5=t2.a1  OR ;
                              t1.a1+5=t2.a2  OR ;
                              t1.a1+5=t2.a3  OR ;
                              t1.a1+5=t2.a4  OR ;
                              t1.a1+5=t2.a5  OR ;
                              t1.a1+5=t2.a6 ,'B5Y1',"")
可以简化为
IIF(INLIST(t1.a1+5, t2.a1, t2.a2, t2.a3, t2.a4, t2.a5, t2.a6), 'B5Y1', '')

坚守VFP最后的阵地
2021-08-06 10:16
fdqzy
Rank: 1
等 级:新手上路
帖 子:368
专家分:0
注 册:2016-8-15
收藏
得分:0 
回复 2楼 sdta
谢谢版主回复,但缺“,”或“;”不是这样的,请看这两段代码:
程序代码:
USE fc\szpt IN 0 ALIAS t1 AGAIN
USE fc\szpt IN 0 ALIAS t2 AGAIN  
SELECT t1
SET RELATION TO RECNO()+1 INTO "t2"
SELECT t1
       REPLACE ALL;
               t2.b5y1 WITH IIF(t1.a1+5=t2.a1  OR ;
                              t1.a1+5=t2.a2  OR ;
                              t1.a1+5=t2.a3  OR ;
                              t1.a1+5=t2.a4  OR ;
                              t1.a1+5=t2.a5  OR ;
                              t1.a1+5=t2.a6 ,'B5Y1',"");
               t2.b5y2 WITH IIF(t1.a2+5=t2.a1  OR ;
                              t1.a2+5=t2.a2  OR ;
                              t1.a2+5=t2.a3  OR ;
                              t1.a2+5=t2.a4  OR ;
                              t1.a2+5=t2.a5  OR ;
                              t1.a2+5=t2.a6 ,'B5Y2',"");
               t2.b5y3 WITH IIF(t1.a3+5=t2.a1  OR ;
                              t1.a3+5=t2.a2  OR ;
                              t1.a3+5=t2.a3  OR ;
                              t1.a3+5=t2.a4  OR ;
                              t1.a3+5=t2.a5  OR ;
                              t1.a3+5=t2.a6 ,'B5Y2',"") 

点保存正常(无“,”)
在此代码后再增加一条:
程序代码:
USE fc\szpt IN 0 ALIAS t1 AGAIN
USE fc\szpt IN 0 ALIAS t2 AGAIN  
SELECT t1
SET RELATION TO RECNO()+1 INTO "t2"
SELECT t1
       REPLACE ALL;
               t2.b5y1 WITH IIF(t1.a1+5=t2.a1  OR ;
                              t1.a1+5=t2.a2  OR ;
                              t1.a1+5=t2.a3  OR ;
                              t1.a1+5=t2.a4  OR ;
                              t1.a1+5=t2.a5  OR ;
                              t1.a1+5=t2.a6 ,'B5Y1',"");
               t2.b5y2 WITH IIF(t1.a2+5=t2.a1  OR ;
                              t1.a2+5=t2.a2  OR ;
                              t1.a2+5=t2.a3  OR ;
                              t1.a2+5=t2.a4  OR ;
                              t1.a2+5=t2.a5  OR ;
                              t1.a2+5=t2.a6 ,'B5Y2',"");
               t2.b5y3 WITH IIF(t1.a3+5=t2.a1  OR ;
                              t1.a3+5=t2.a2  OR ;
                              t1.a3+5=t2.a3  OR ;
                              t1.a3+5=t2.a4  OR ;
                              t1.a3+5=t2.a5  OR ;
                              t1.a3+5=t2.a6 ,'B5Y2',"");    
              t2.b5y4 WITH IIF(t1.34+5=t2.a1  OR ;
                              t1.a4+5=t2.a2  OR ;
                              t1.a4+5=t2.a3  OR ;
                              t1.a4+5=t2.a4  OR ;
                              t1.a4+5=t2.a5  OR ;
                              t1.a4+5=t2.a6 ,'B5Y4',"")

点保存报错
2021-08-06 11:10
fdqzy
Rank: 1
等 级:新手上路
帖 子:368
专家分:0
注 册:2016-8-15
收藏
得分:0 
以下是引用sdta在2021-8-6 10:16:01的发言:

可以简化为
IIF(INLIST(t1.a1+5, t2.a1, t2.a2, t2.a3, t2.a4, t2.a5, t2.a6), 'B5Y1', '')

这个很好,又学习了!
2021-08-06 11:12
fdqzy
Rank: 1
等 级:新手上路
帖 子:368
专家分:0
注 册:2016-8-15
收藏
得分:0 
以下是引用fdqzy在2021-8-6 11:10:33的发言:

谢谢版主回复,但缺“,”或“;”不是这样的,请看这两段代码:
USE fc\szpt IN 0 ALIAS t1 AGAIN
USE fc\szpt IN 0 ALIAS t2 AGAIN  
SELECT t1
SET RELATION TO RECNO()+1 INTO "t2"
SELECT t1
       REPLACE ALL;
               t2.b5y1 WITH IIF(t1.a1+5=t2.a1  OR ;
                              t1.a1+5=t2.a2  OR ;
                              t1.a1+5=t2.a3  OR ;
                              t1.a1+5=t2.a4  OR ;
                              t1.a1+5=t2.a5  OR ;
                              t1.a1+5=t2.a6 ,'B5Y1',"");
               t2.b5y2 WITH IIF(t1.a2+5=t2.a1  OR ;
                              t1.a2+5=t2.a2  OR ;
                              t1.a2+5=t2.a3  OR ;
                              t1.a2+5=t2.a4  OR ;
                              t1.a2+5=t2.a5  OR ;
                              t1.a2+5=t2.a6 ,'B5Y2',"");
               t2.b5y3 WITH IIF(t1.a3+5=t2.a1  OR ;
                              t1.a3+5=t2.a2  OR ;
                              t1.a3+5=t2.a3  OR ;
                              t1.a3+5=t2.a4  OR ;
                              t1.a3+5=t2.a5  OR ;
                              t1.a3+5=t2.a6 ,'B5Y2',"")
点保存正常(无“,”)
在此代码后再增加一条:
USE fc\szpt IN 0 ALIAS t1 AGAIN
USE fc\szpt IN 0 ALIAS t2 AGAIN  
SELECT t1
SET RELATION TO RECNO()+1 INTO "t2"
SELECT t1
       REPLACE ALL;
               t2.b5y1 WITH IIF(t1.a1+5=t2.a1  OR ;
                              t1.a1+5=t2.a2  OR ;
                              t1.a1+5=t2.a3  OR ;
                              t1.a1+5=t2.a4  OR ;
                              t1.a1+5=t2.a5  OR ;
                              t1.a1+5=t2.a6 ,'B5Y1',"");
               t2.b5y2 WITH IIF(t1.a2+5=t2.a1  OR ;
                              t1.a2+5=t2.a2  OR ;
                              t1.a2+5=t2.a3  OR ;
                              t1.a2+5=t2.a4  OR ;
                              t1.a2+5=t2.a5  OR ;
                              t1.a2+5=t2.a6 ,'B5Y2',"");
               t2.b5y3 WITH IIF(t1.a3+5=t2.a1  OR ;
                              t1.a3+5=t2.a2  OR ;
                              t1.a3+5=t2.a3  OR ;
                              t1.a3+5=t2.a4  OR ;
                              t1.a3+5=t2.a5  OR ;
                              t1.a3+5=t2.a6 ,'B5Y2',"");   
              t2.b5y4 WITH IIF(t1.34+5=t2.a1  OR ;
                              t1.a4+5=t2.a2  OR ;
                              t1.a4+5=t2.a3  OR ;
                              t1.a4+5=t2.a4  OR ;
                              t1.a4+5=t2.a5  OR ;
                              t1.a4+5=t2.a6 ,'B5Y4',"")
点保存报错

找到了,增加的一条“IIF(t1.34+5=t2.a1  OR ;”应为t1.a4
2021-08-06 11:34
fdqzy
Rank: 1
等 级:新手上路
帖 子:368
专家分:0
注 册:2016-8-15
收藏
得分:0 
回复 5楼 fdqzy
但这种写法有行数限制
2021-08-06 11:58
sdta
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:江苏省连云港市
等 级:版主
威 望:335
帖 子:9841
专家分:27213
注 册:2012-2-5
收藏
得分:0 
增加一个辅助用表,将替换内容保存在一个表中

坚守VFP最后的阵地
2021-08-06 12:24
fdqzy
Rank: 1
等 级:新手上路
帖 子:368
专家分:0
注 册:2016-8-15
收藏
得分:0 
回复 7楼 sdta
谢谢!
2021-08-06 18:19
快速回复:这个是什么原因?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.050772 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved