如何看 应用程序中 用来连接数据库的 ini文件

raingod 2005-06-21 03:20:19

[Database]
DBMS=MSS MS SQL Server 2000
Database=
ServerName=
UserId=
DatabasePassword=
LogPassword= //什么意思
LogId=
Lock=
DbParm=
Prompt=0
DataSource= //什么意思 是还用odbc设置数据源吗
...全文
121 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
goody9807 2005-06-28
  • 打赏
  • 举报
回复
LogId、LogPassword 有作用
UserId=
DatabasePassword=
可以不写
出现了这个错误 肯定是of_connecttodb函数返回值为负值

一种情况是 li_ret = inv_appsecurity.of_encrypt(sqlca.logpass,ls_encryptpass,"D")
为负

另一种是 sqlca.of_connect() < 0 连接数据库失败

检查一下这2个地方
malingfeng 2005-06-21
  • 打赏
  • 举报
回复
一般都这么用
lovelihp 2005-06-21
  • 打赏
  • 举报
回复
楼上的方法不错!!:)
xiaoluoxy 2005-06-21
  • 打赏
  • 举报
回复
自己到Tools->DataBase Profiles里建立一个数据库连接,在edit窗口中察看Preview即可看到数据库连接详细信息。
raingod 2005-06-21
  • 打赏
  • 举报
回复
pfc_prelogondlg()函数

integer li_ret
string ls_logpass
string ls_loc


call super::pfc_prelogondlg;
ls_loc = classname() + "/pfc_PreLogonDlg"
ls_logpass = sqlca.logpass
li_ret = of_connecttodb(sqlca.userid)

if li_ret < 0 then
messagebox("Error","Cannot connect to the Database (Pre-Logon)",stopsign!)
pfc_exit()
end if

anv_logonattrib.of_initialise()
sqlca.of_disconnect()
sqlca.logpass = ls_logpass
return



of_connecttodb (string as_userid) returns integer
函数如下

integer li_ret
string ls_encryptpass
string ls_host
string ls_hoststring
string ls_logpass


setpointer(hourglass!)
sqlca.userid = as_userid
inv_appsecurity.is_dbencryptkey = is_dbencryptkey
li_ret = inv_appsecurity.of_encrypt(sqlca.logpass,ls_encryptpass,"D")

if li_ret < 0 then
return -1
end if

sqlca.logpass = ls_encryptpass
ls_host = "Host = "
ls_hoststring = "'" + "ST_" + as_userid + "'"
ls_host = ls_host + ls_hoststring
sqlca.dbparm = ls_host

if sqlca.of_connect() < 0 then
return -1
end if

return 1

现在报如下错
messagebox("Error","Cannot connect to the Database (Pre-Logon)",stopsign!)

li_d_s 2005-06-21
  • 打赏
  • 举报
回复
一般来说,每种不同的DBMS接口用到的参数都是不一样的,比如你用的mssql,那么只要用到DBMS、Database、ServerName、LogId、LogPassword、和DbParm这几项的,LogPassword是你登录数据库用户的密码,别的那些是给别的DBMS用的

401

社区成员

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

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