帮我看一下,为什么生成随机密码只执行一次?
我用游标做生成随机密码,有20条记录,密码都更新了,但密码值一样!
请教是何原因?
long i, ll_loop
string ls_result,ls_mima
int li_num,l_x
boolean lb_continue
long ls_rowcount
select count(*) into:ls_rowcount from j_renyuan where j_renyuan.hangming='hangmin';
hpb_1.maxposition=ls_rowcount
l_x=1
declare mima_cur cursor for select j_renyuan.mima from j_renyuan where j_renyuan.hangming='201';
open mima_cur;
lb_continue=True
do while lb_continue=True
FETCH mima_cur
INTO:ls_mima;
If sqlca.sqlcode=0 Then
// 生成随机密码
ll_loop = 8
for i = 1 to ll_loop
li_num = Rand(122)
choose case li_num
case 48 to 57
ls_result = ls_result + char(li_num) //数字
case 65 to 90
ls_result = ls_result + char(li_num) //大写字母
case 97 to 122
ls_result = ls_result + char(li_num) //小写字母
case else
ll_loop++
end choose
next
//密码生成完毕
//messagebox('',ls_result)
UPDATE j_renyuan SET j_renyuan.mima=:ls_result
WHERE CURRENT of mima_cur;
hpb_1.position=l_x
l_x=l_x+1
Else
lb_continue=False
parent.title="生成结束!"
End If
LOOP
commit;
close mima_cur;