
PB连接数据库出了个语法错误,谁帮忙看看
//数据库连接SQLCA.DBMS="MSSMicrosoftSQLServer"SQLCA.Database="Pb_Data"SQLCA.LogPass="cwpas...
//数据库连接
SQLCA.DBMS = "MSS Microsoft SQL Server"
SQLCA.Database = "Pb_Data"
SQLCA.LogPass = "cwpass12!"
SQLCA.ServerName = "wangxu"
SQLCA.LogId = "sa"
SQLCA.AutoCommit = False
SQLCA.DBParm = ""
connect;
//定义变量
string vname,vpass
vname=sle_1.text
vpass=sle_2.text
if sle_1.text="" or sle_2.text="" then
messagebox("提示","输入信息不合法",information!,ok!,2)
else
select "BM_users"."userName","BM_users"."userPass","BM_users"."userType"
into :vusername,:vuserpass,:vusertype
from BM_users
where("BM_users"."userName"=:vname)and("BM_users"."userPass"=:vpass);
if sqlca.sqlcode=0 then
messagebox("提示","登录成功")
else
messagebox("提示","输入数据错误")
end if
end if
//这是在登录按钮中的代码,vusername,vuserpass,vusertype是定义的全局变量,调试提示“在userName附近有语法错误” 展开
SQLCA.DBMS = "MSS Microsoft SQL Server"
SQLCA.Database = "Pb_Data"
SQLCA.LogPass = "cwpass12!"
SQLCA.ServerName = "wangxu"
SQLCA.LogId = "sa"
SQLCA.AutoCommit = False
SQLCA.DBParm = ""
connect;
//定义变量
string vname,vpass
vname=sle_1.text
vpass=sle_2.text
if sle_1.text="" or sle_2.text="" then
messagebox("提示","输入信息不合法",information!,ok!,2)
else
select "BM_users"."userName","BM_users"."userPass","BM_users"."userType"
into :vusername,:vuserpass,:vusertype
from BM_users
where("BM_users"."userName"=:vname)and("BM_users"."userPass"=:vpass);
if sqlca.sqlcode=0 then
messagebox("提示","登录成功")
else
messagebox("提示","输入数据错误")
end if
end if
//这是在登录按钮中的代码,vusername,vuserpass,vusertype是定义的全局变量,调试提示“在userName附近有语法错误” 展开
展开全部
首先sql语句语法有点问题,where子句和and之间应该有空格,不然识别出问题
其次程序的健壮性不高,拦截空值还需要isnull()判断,不然null值拦截不到
还有验证输入有效性,应该select count(*) into :li_count from bn_users where userName=:vname and userPass =:vpass;
检验是否能够得到有效数据,而不能直接取数
其次程序的健壮性不高,拦截空值还需要isnull()判断,不然null值拦截不到
还有验证输入有效性,应该select count(*) into :li_count from bn_users where userName=:vname and userPass =:vpass;
检验是否能够得到有效数据,而不能直接取数
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询