注册 登录
编程论坛 VFP论坛

运行修饰,补齐错误

chychychy 发布于 2024-06-26 16:52, 479 次点击
运行修饰,程序自动将第4行后的bj,自动补齐为bjmc,如果去掉第4行就不会出现这个错误,为什么回这样,vfp版本9.0sp1
只有本站会员才能查看附件,请 登录
程序代码:
Clea
Close Databases
Use cj In 0
Blank Fields bjmc, njmc All&&&测试用
*Browse&&&测试用

Select Distinct zf,0000 pm From cj Order By zf Desc Into Cursor tpm Readwrite
Update tpm Set pm=Recno()
Update cj Set cj.njmc=tpm.pm From tpm Where cj.zf=tpm.zf

Select cj
Select Distinct  bj From cj Into Array abj
*?Alen(abj)&&&测试用
For i=1 To Alen(abj)
    *?abj[i]&&&测试用
    Select Distinct zf,0000 pm From cj Order By zf Desc Where Alltrim(cj.bj)=abj[i] Into Cursor tbj1 Readwrite
    Update tbj1 Set pm=Recno()
    *SELECT tbj1&&&测试用
    *BROWSE&&&测试用
    Update cj Set cj.bjmc=tbj1.pm From tbj1 Where cj.zf=tbj1.zf And Alltrim(cj.bj)=abj[i]
Endfor
Select * Order By zf Desc,bjmc From cj&&&测试用

修饰后变成这样
Close Databases
Use cj In 0
Blank Fields bjmc, njmc All&&&测试用
*Browse&&&测试用

Select Distinct zf,0000 pm From cj Order By zf Desc Into Cursor tpm Readwrite
Update tpm Set pm=Recno()
Update cj Set cj.njmc=tpm.pm From tpm Where cj.zf=tpm.zf

Select cj
Select Distinct  bjmc From cj Into Array abj
*?Alen(abj)&&&测试用
For i=1 To Alen(abj)
*?abj[i]&&&测试用
    Select Distinct zf,0000 pm From cj Order By zf Desc Where Alltrim(cj.bjmc)=abj[i] Into Cursor tbj1 Readwrite
    Update tbj1 Set pm=Recno()
*SELECT tbj1&&&测试用
*BROWSE&&&测试用
    Update cj Set cj.bjmc=tbj1.pm From tbj1 Where cj.zf=tbj1.zf And Alltrim(cj.bjmc)=abj[i]
Endfor
Select * Order By zf Desc,bjmc From cj&&&测试用






[此贴子已经被作者于2024-6-26 16:53编辑过]

5 回复
#2
sdta2024-06-26 17:44
在VFP9 7423 下运行没有问题
#3
csyx2024-06-26 18:46
可能你的修饰设置是“匹配首次出现”,应该选 "不改变"
只有本站会员才能查看附件,请 登录


[此贴子已经被作者于2024-6-26 18:53编辑过]

#4
easyppt2024-06-26 21:07
csyx 版主 正解

我以前也碰到过楼主的问题 ,就是这个选项造成的
#5
chychychy2024-06-27 07:05
回复 3楼 csyx
测试果然如此,谢谢!我y以前以前没注意这个开关的作用。用的英文版本,厉害

[此贴子已经被作者于2024-6-27 07:13编辑过]

#6
chychychy2024-06-27 07:14
回复 2楼 sdta
是我在3楼图片的开关位置未正确选择
1