注册 登录
编程论坛 PowerBuilder

谁来教教我啊

lynnbibby 发布于 2006-11-13 21:44, 1351 次点击

我在数据库中建了一个stum 表有sno,sname,password
想搞一个登陆界面可老报“没有这个用户!”,到底什么问题啊,呜!!!

int li_cnt
string ls_password
int ls_cnt=0
//用户名 = 输入的用户名
if sle_sno.text='' then
messagebox('提示','用户号不能为空!')
else
select count(*) into :li_cnt
from stum
where sno = sle_sno.text;
if li_cnt = 0 then
messagebox('提示','没有这个用户!')
else
select password into :ls_password
from stum
where password=sle_password.text;
if sle_password.text <> ls_password then
ls_cnt++;
if ls_cnt >3 then
messagebox('提示','输入次数超过3次!')
halt close
end if
else
open(w_stu)
end if
end if
end if

10 回复
#2
jasonamoy2006-11-13 22:27
表stum中sno后面可能有空格
select count(*) into :li_cnt
from stum
where rtrim(sno) = sle_sno.text;
#3
lynnbibby2006-11-14 22:53
呜。。。没用啊,楼上的大哥,我改了还是报那个错误。
#4
lynnbibby2006-11-15 21:43
请大家看下这个写法应该怎么改哦,谢谢了

string stu_sno,stu_password
select sno,password into: stu_sno,:stu_password
from stum group by sno
if(sle_sno.text=stu_sno and sle_password.text=stu_password) //这句该怎么改才对啊
open(w_stu)
close(w_main)
end if
#5
waiyi2006-11-16 08:37
select password into :ls_password
from stum
where password=sle_password.text;
这句写错了~~
改为:
select password into :ls_password
from stum
where sno = sle_sno.text;
#6
waiyi2006-11-16 08:43

string ls_id
string ls_password
string ls_CorrectPswd

if IsNull(sle_id.text) or len(trim(sle_pass.text)) = 0 then
messagebox("系统提示","请输入账号或密码",Exclamation!)
return
end if //如果帐号或密码为空


ls_id = sle_id.text
ls_password = sle_pass.text
select password into :ls_CorrectPswd
from idlist //idlist表
where id = : ls_id;
if sqlca.sqlcode=0 then //操作成功
if ls_CorrectPswd = ls_password then
open (w_main)
close (parent)
return
else
messagebox("提示","密码不正确")
sle_pass.text=""
end if
else
messagebox("提示","帐号不存在")
end if
这个是我以前做的

[此贴子已经被作者于2006-11-16 8:44:35编辑过]

#7
路過2007-01-05 08:04
我同意waiyir的說法
#8
notbig2007-01-13 00:03
sle_sno.text 忘了加:号
#9
xinbingo2007-01-17 00:44
waiyi同意你的说法,还有你的select 最后连接了库没? using sqlca;
#10
notbig2007-01-17 08:52
还要看是什么数据库,当字段类型是CHAR的时候,SQL要去空格才行。
#11
notbig2007-01-17 17:45
怎么同楼下的另一个帖子是一样的,不通这么多马甲?
1