pb 连接sqlserer 数据库

xwq123456 2007-05-14 11:53:20
pb 里连接sql server 数据库,双击运行系统时连接数据库正常,但是我在注册表自动运行时就连接不上数据库,sqlcode=-1 sqltext='登录不正确' 请问我应该如何解结????谢谢
...全文
373 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
jdsnhan 2007-05-22
  • 打赏
  • 举报
回复
自运行时,确认网络是否已经正常连接。
zhgwbzhd 2007-05-22
  • 打赏
  • 举报
回复
嗯,LS正解。
njxumingqun 2007-05-22
  • 打赏
  • 举报
回复
给你一段代码:
String ls_ini, ls_section
//***** 数据库参数设置、连接数据库(sqlca)
ls_ini = 'njxmq_his.ini'
ls_section = 'njxmqhisdatabase'
SQLCA.DBMS = ProfileString(ls_ini,ls_section,"DBMS", " ")
SQLCA.Database = ProfileString(ls_ini,ls_section,"DataBase", " ")
SQLCA.LogID = ProfileString(ls_ini,ls_section,"LogID", " ")
SQLCA.LogPass = ProfileString(ls_ini,ls_section,"LogPassword", " ")
SQLCA.ServerName = ProfileString(ls_ini,ls_section,"ServerName", " ")
SQLCA.UserID = ProfileString(ls_ini,ls_section,"UserID", " ")
SQLCA.DBPass = ProfileString(ls_ini,ls_section,"DatabasePassword", " ")
SQLCA.Lock = ProfileString(ls_ini,ls_section,"Lock", " ")
SQLCA.AutoCommit = False
Connect Using sqlca;
if sqlca.sqlcode <> 0 then
MessageBox ("不能连接管理系统数据库", sqlca.sqlerrtext)
halt
end if

同时给你'njxmq_his.ini'文件的内容
[njxmqhisdatabase]
DBMS=MSS (Msoft) SQL Server 6.X
Database=njxmqhis_sql
UserId=
DatabasePassword=
ServerName=.
LogId=sa
Lock=
Prompt=0
LogPassword=pppppp
其中Database=njxmqhis_sql定义要连接的数据库
LogId=sa是连接数据库的ID
LogPassword=pppppp是ID=SA对应的密码
ServerName=.是数据库所在电脑的名称,'.'代表本机










xwq123456 2007-05-18
  • 打赏
  • 举报
回复
好像没能解决问题,能否还有什么办法??最好是自已先试一下
anzhuge 2007-05-14
  • 打赏
  • 举报
回复
有几种可能:
1. 操作数据库的'用户',未设置好
2. 访问数据库方式选择'SQL Server 和 Windows',试试看.....

752

社区成员

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

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