登陆问题!总是不正确!

xhwy2 2006-06-07 11:02:39
我的“确定”按钮代码如下:
string correct_pswd ,g_pswd
integer g_input_time=0
g_input_time=g_input_time+1
g_pswd=sle_2.text
if sle_1.text=''or sle_2.text='' then
messagebox("警告","请输入用户名和密码!")
else
select x_pswd into:correct_pswd from user_password where x_user='sle_1.text';
if g_pswd=correct_pswd then
open(w_main)
close(w_password)
else
if g_input_time>=3 then
messagebox("警告","你无权进入!")
close(w_password)
else
messagebox("警告","你输入口令有错误,请重新输入!")
end if
end if
end if
描述:1:在工程里已同数据库连通
‘// Profile stumanager
SQLCA.DBMS = "MSS Microsoft SQL Server"
SQLCA.Database = "stumanager"
SQLCA.ServerName = "XH"
SQLCA.LogId = "sa"
SQLCA.AutoCommit = False
SQLCA.DBParm = ""
open(w_password)’
运行的问题:1:总显示“你输入口令有错误,请重新输入”,不能正确登陆。
2:无论登陆好多次,都不显示“你无权进入”,说明这段代码没有起作用。
请问是啥原因,谢谢!
...全文
262 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
伟大的左前卫 2006-06-08
  • 打赏
  • 举报
回复
select user_psw into:correct_pswd from tbl_user where user_id=:uid;
这行换成你自己的
select x_pswd into:correct_pswd from user_password where x_user=:uid
伟大的左前卫 2006-06-08
  • 打赏
  • 举报
回复
string correct_pswd ,g_pswd,uid
//integer g_input_time=0 --->在global variables里 integer g_input_time,否则每按一次都清0
g_input_time=g_input_time+1
g_pswd=sle_2.text
uid=sle_1.text
if sle_1.text=''or sle_2.text='' then
messagebox("警告","请输入用户名和密码!")
else
select user_psw into:correct_pswd from tbl_user where user_id=:uid;
if g_pswd=correct_pswd then
open(w_main)
close(parent)
else
if g_input_time>=3 then
messagebox("警告","你无权进入!")
close(parent)
else
messagebox("警告","你输入口令有错误,请重新输入!")
end if
end if
end if
xhwy2 2006-06-07
  • 打赏
  • 举报
回复
上面的办法都试了,没有解决啊!我不知道上面的修改的理由是啥子?救命啊!
JustNoOtherWay 2006-06-07
  • 打赏
  • 举报
回复
晕,1,是这样的错误吧
String Ls_User

Ls_User=Trim(sle_1.text)

......where x_user=:Ls_User;
圣殿骑士18 2006-06-07
  • 打赏
  • 举报
回复
select x_pswd into:correct_pswd from user_password where x_user=:sle_1.text;
或者
string ls_sle
ls_sle = sle_1.text
select x_pswd into:correct_pswd from user_password where x_user=:ls_sle;
JustNoOtherWay 2006-06-07
  • 打赏
  • 举报
回复
1. x_user是什么类型?Ltrim(Rtrim(x_user))='sle_1.text' 试下
2.g_input_time是局部变量肯定不行

754

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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