请教:怎样实现按一定检索条件逐条更新记录的一个字段

sunlijun 2003-03-22 05:16:43
我想实现的功能是:根据操作员所在部门,对此部门所有人员生成随机登陆密码,没生成一个密码,就写入数据库中密码字段。
下面是我生成随机密码的代码:
long i, ll_loop
string ls_result

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

...全文
29 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
sunlijun 2003-03-22
  • 打赏
  • 举报
回复
谢谢!
再请教一下,因为人员很多,我想做一个进度条,怎样控制?
qlzgdzfl 2003-03-22
  • 打赏
  • 举报
回复
少了东东连
UPDATE j_renyuan SET j_renyuan.mima=ls_result
为UPDATE j_renyuan SET j_renyuan.mima=:ls_result

sunlijun 2003-03-22
  • 打赏
  • 举报
回复
帮我看一下有什么错误:

提示:ls_result不是字段,本来就不是字段呀!
long i, ll_loop
string ls_result
int li_num
string ls_mima
boolean lb_continue

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
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;
Else
lb_continue=False
End If
LOOP
ice2water 2003-03-22
  • 打赏
  • 举报
回复
使用游标及update语句即可

1,109

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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