数据库连接问题(焦急等待中)

l12456789 2005-03-01 03:46:50
// Profile book
gfun_dbconnect("book.ini",sqlca)
RegisterBitmapClient( 1944234)
//connect;
是什么意思??
我可以改成这样吗?
// Profile book
SQLCA.DBMS = "MSS Microsoft SQL Server"
SQLCA.Database = "book"
SQLCA.LogPass = <***>
SQLCA.ServerName = "BAI-S32G5GHY6E1"
SQLCA.LogId = "sa"
SQLCA.AutoCommit = True
SQLCA.DBParm = ""
然后这两个gfun_dbconnect("book.ini",sqlca)
RegisterBitmapClient( 1944234)不要了!
可以吗?。。。菜鸟中。。。
谁有数据库与pb连接的代码,给小弟一份  谢谢了!
...全文
168 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
DBtester 2005-03-03
  • 打赏
  • 举报
回复
如果要同时建多个数据库连接,就先要有多个transaction对象,用法同SQLCA一样,(其实sqlca就是PB默认的transaction全局变量)

transaction tans1, trans2
trans1 = Create transaction
trans2 = Create transaction

trans1.DBMS = "MSS Microsoft SQL Server"
trans1.Database = "book1"
....
connect using trans1;
if trans1.sqlcode=0 then
//第一个连接成功
else
//第一个连接失败
end if

trans2.DBMS = "MSS Microsoft SQL Server"
trans2.Database = "book2"
....
connect using trans2;
if trans2.sqlcode=0 then
//第二个连接成功
else
//第二个连接失败
end if

zp_private 2005-03-03
  • 打赏
  • 举报
回复
至于建立两个数据库的连接吗,我也没用过,让我想想
winnl 2005-03-03
  • 打赏
  • 举报
回复
如何在PB中创建两个数据库连接啊,急切求~~~望详细讲解
xxdyy 2005-03-03
  • 打赏
  • 举报
回复
狗狗,你忘了一件事啦!System.ini文件的内容啦!装了PB的话,在硬盘里搜索“PB.INI”,然后嘛......呵呵,复制、粘贴啦!
seagullflying 2005-03-03
  • 打赏
  • 举报
回复
hygougou(狗狗) 已经说得so明白了,还思考什么,照搬而已,哈哈。。。。
sky911911 2005-03-01
  • 打赏
  • 举报
回复
还不是很明白哦 呵呵 思考ing。。。。。。。。。。
qltouming 2005-03-01
  • 打赏
  • 举报
回复
拼写错了,esle应为else,
hygougou 2005-03-01
  • 打赏
  • 举报
回复
数据库PB连接代码

////////////////////////////////////////////////
// 连接数据库 //
////////////////////////////////////////////////

String ls_inifile,ls_password,ls_sfjm

ls_inifile = '.\System.ini'

ls_sfjm = ProfileString(ls_inifile,'数据库','加密','YES')

sqlca.dbms = ProfileString(ls_inifile,'MISDB','dbms','MSS Microsoft SQL Server 6.x')
sqlca.servername = ProfileString(ls_inifile,'MISDB','servername','lisserver')
sqlca.database = ProfileString(ls_inifile,'MISDB','database','lisdb')
sqlca.logid = ProfileString(ls_inifile,'MISDB','logid','lis')
sqlca.logpass = ProfileString(ls_inifile,'MISDB','logpass','7540000E')
sqlca.dbparm = ProfileString(ls_inifile,'MISDB','dbparm','')
sqlca.AutoCommit = True

Connect Using sqlca;
If sqlca.sqlcode <> 0 Then
Return False //连接数据库失败
Else
Return True //连接数据库成功
End If



===========================
system.ini文件的写法

===========================
[MISDB]

DBMS=MSS Microsoft SQL Server 6.x
ServerName=bodysoul
Database=mis
LogID=sa
LogPass=lodestar

================================================================
qltouming 2005-03-01
  • 打赏
  • 举报
回复
// Profile book
SQLCA.DBMS = "MSS Microsoft SQL Server"
SQLCA.Database = "book"
SQLCA.LogPass = <***>
SQLCA.ServerName = "BAI-S32G5GHY6E1"
SQLCA.LogId = "sa"
SQLCA.AutoCommit = True
SQLCA.DBParm = ""
------------------
你的“BOOK.ini”中一定有与“sqlca.”后边类似的字符,照样子把“=”号后边的东西添到位置上去,原来那两句不要的话得在最后再加上这样几句:
connect;
if sqlca.sqlcode<>0 then
rollback;
messagebox('','未连上')
return
esle
commit;
end if
li_d_s 2005-03-01
  • 打赏
  • 举报
回复
数据库连接的信息都在book.ini里面了,参照里面的ServerName ,database,logid,logpass,dbparm在db profile里面建一个,然后从preview里面拷贝到script就可以了
「已注销」 2005-03-01
  • 打赏
  • 举报
回复
可以啊!
book.ini其中已是连库
zhanghengyuan_ren 2005-03-01
  • 打赏
  • 举报
回复
book.ini是连接文件.可以把book.ini中的程序拷出来.帖到程序里就可以了

752

社区成员

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

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