PB9.0怎么与SQL2000使用本地接口连接数据库?连接不上是因为什么,一般那里容易出现问题
答案:2 悬赏:60 手机版
解决时间 2021-01-27 13:47
- 提问者网友:杀手的诗
- 2021-01-26 16:46
和代码应该无关,代码都是按书上写的
最佳答案
- 五星知识达人网友:神的生死簿
- 2021-01-26 18:00
1.SQL sp4
2.可以试着用ODBC测试看能不能连接上SQL,如果能连上,证明数据库没问题。
3.如果是脱离PB环境,检查你的DLL文件是否齐全。
4.如果不用SQLCA,代码如下:
If Not Fileexists("bzyb.ini") Then
MessageBox ("警告","找不到系统配置文件,请与管理员联系!")
Halt
End If
//定义事务对象
YBJK_YY = CREATE Transaction
YBJK_YY.DBMS = ProfileString("bzyb.ini","database","DBMS","")
YBJK_YY.Database = ProfileString("bzyb.ini","database","Database","")
YBJK_YY.LogPass = ProfileString("bzyb.ini","database","LogPass","")
YBJK_YY.ServerName = ProfileString("bzyb.ini","database","ServerName","")
YBJK_YY.LogId = ProfileString("bzyb.ini","database","LogId","")
YBJK_YY.DBParm = ProfileString("bzyb.ini","database","DBParm","")
CONNECT USING YBJK_YY ;
If YBJK_YY.Sqlcode < 0 Then
MessageBox ("警告","数据库连接失败,请检查配置文件")
Halt
End If
配置文件信息如下:
[database]
DBMS = MSS Microsoft SQL Server 6.x
Database = newhis
LogPass = 1234
ServerName = .
LogId = sa
AutoCommit = True
DBParm =
5.如果使用SQLCA,代码如下:
If Not Fileexists("his.ini") Then
MessageBox ("警告","找不到HIS系统配置文件,请与管理员联系!")
Halt
End If
//定义HIS事务对象
SQLCA.DBMS = ProfileString("his.ini","database","DBMS","")
SQLCA.Database = ProfileString("his.ini","database","Database","")
SQLCA.LogPass = ProfileString("his.ini","database","LogPass","")
SQLCA.ServerName = ProfileString("his.ini","database","ServerName","")
SQLCA.LogId = ProfileString("his.ini","database","LogId","")
SQLCA.DBParm = ProfileString("his.ini","database","DBParm","")
CONNECT USING SQLCA ;
If SQLCA.Sqlcode <> 0 Then
MessageBox ("警告","数据库连接失败,请检查配置文件")
End If
Open (w_pass)
配置文件如下:
[database]
DBMS = MSS Microsoft SQL Server 6.x
LogPass =
Database = bzmyy
ServerName = .
LogId = sa
AutoCommit = False
DBParm =
2.可以试着用ODBC测试看能不能连接上SQL,如果能连上,证明数据库没问题。
3.如果是脱离PB环境,检查你的DLL文件是否齐全。
4.如果不用SQLCA,代码如下:
If Not Fileexists("bzyb.ini") Then
MessageBox ("警告","找不到系统配置文件,请与管理员联系!")
Halt
End If
//定义事务对象
YBJK_YY = CREATE Transaction
YBJK_YY.DBMS = ProfileString("bzyb.ini","database","DBMS","")
YBJK_YY.Database = ProfileString("bzyb.ini","database","Database","")
YBJK_YY.LogPass = ProfileString("bzyb.ini","database","LogPass","")
YBJK_YY.ServerName = ProfileString("bzyb.ini","database","ServerName","")
YBJK_YY.LogId = ProfileString("bzyb.ini","database","LogId","")
YBJK_YY.DBParm = ProfileString("bzyb.ini","database","DBParm","")
CONNECT USING YBJK_YY ;
If YBJK_YY.Sqlcode < 0 Then
MessageBox ("警告","数据库连接失败,请检查配置文件")
Halt
End If
配置文件信息如下:
[database]
DBMS = MSS Microsoft SQL Server 6.x
Database = newhis
LogPass = 1234
ServerName = .
LogId = sa
AutoCommit = True
DBParm =
5.如果使用SQLCA,代码如下:
If Not Fileexists("his.ini") Then
MessageBox ("警告","找不到HIS系统配置文件,请与管理员联系!")
Halt
End If
//定义HIS事务对象
SQLCA.DBMS = ProfileString("his.ini","database","DBMS","")
SQLCA.Database = ProfileString("his.ini","database","Database","")
SQLCA.LogPass = ProfileString("his.ini","database","LogPass","")
SQLCA.ServerName = ProfileString("his.ini","database","ServerName","")
SQLCA.LogId = ProfileString("his.ini","database","LogId","")
SQLCA.DBParm = ProfileString("his.ini","database","DBParm","")
CONNECT USING SQLCA ;
If SQLCA.Sqlcode <> 0 Then
MessageBox ("警告","数据库连接失败,请检查配置文件")
End If
Open (w_pass)
配置文件如下:
[database]
DBMS = MSS Microsoft SQL Server 6.x
LogPass =
Database = bzmyy
ServerName = .
LogId = sa
AutoCommit = False
DBParm =
全部回答
- 1楼网友:怙棘
- 2021-01-26 19:25
在使用数据库之前配置数据库连接参数
sqlca.dbms = "mss microsoft sql server"
sqlca.database = 数据库名称
sqlca.logpass = 数据库用户密码
sqlca.servername = 服务器ip+端口号(1433可以省略)
sqlca.logid = 数据库登录用户
sqlca.autocommit = true
sqlca.dbparm = ""
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯