怎么在w_load窗口中新建了一个用于连接数据库的窗口函数load_connect 求具体操作???
1个回答
展开全部
1、首先连接数据库
可在窗口的open事件中填写
SQLCA.DBMS = "MSS Microsoft SQL Server"
SQLCA.Database = "数据库名"
SQLCA.LogPass = 登录sqlserver的口令
SQLCA.ServerName = "服务器名称或IP"
SQLCA.LogId = "登录sqlserver的账户"
SQLCA.AutoCommit = False
SQLCA.DBParm = ""
Connect using SQLCA;
If SQLCA.SQLCode <> 0 Then
messagebox('', '未能连到数据库' )
disconnect using SQLCA;
end if
2、建一账户表如tb_zhb(zh char(20),kl char(30))
3、
函数load_connect ()返回参数为整型 integer
string ls_user,ls_pass,ls_zh,ls_kl
ls_user = sle_user.text
ls_pass = sle_password.text
select zh,kl into :ls_zh,:ls_kl from tb_zhb where zh=:ls_user;
if (ls_pass <> "" and ls_pass = ls_kl) then
return 0
else
MessageBox('',"用户口令错!")
return -1
end if
4、登录按钮click事件
if load_connect ()=0 then
close(parent)
//调入主程序界面
end if
4、退出按钮click事件
close(parent)
可在窗口的open事件中填写
SQLCA.DBMS = "MSS Microsoft SQL Server"
SQLCA.Database = "数据库名"
SQLCA.LogPass = 登录sqlserver的口令
SQLCA.ServerName = "服务器名称或IP"
SQLCA.LogId = "登录sqlserver的账户"
SQLCA.AutoCommit = False
SQLCA.DBParm = ""
Connect using SQLCA;
If SQLCA.SQLCode <> 0 Then
messagebox('', '未能连到数据库' )
disconnect using SQLCA;
end if
2、建一账户表如tb_zhb(zh char(20),kl char(30))
3、
函数load_connect ()返回参数为整型 integer
string ls_user,ls_pass,ls_zh,ls_kl
ls_user = sle_user.text
ls_pass = sle_password.text
select zh,kl into :ls_zh,:ls_kl from tb_zhb where zh=:ls_user;
if (ls_pass <> "" and ls_pass = ls_kl) then
return 0
else
MessageBox('',"用户口令错!")
return -1
end if
4、登录按钮click事件
if load_connect ()=0 then
close(parent)
//调入主程序界面
end if
4、退出按钮click事件
close(parent)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询