注册 登录
编程论坛 PowerBuilder

请教:pb与SQL连接

wjcayh81 发布于 2006-12-01 20:21, 3140 次点击

我是新手请问各位高手怎么用ini文件连接SQL库呀
怎么写呀代码和ini文件怎么写呀?
谢谢各位了!!!!!!!!!!!!!

1 回复
#2
tzy212007-07-09 16:46
回复:(wjcayh81)请教:pb与SQL连接

在INI文件里这样设置
[database]
DBMS=MSS Microsoft SQL Server 6.x
Database=csmd_new_hm
UserId=
DatabasePassword=
LogPassword=
ServerName=.
LogId=sa
Lock=
DbParm=
Prompt=0


在PB中这样写
DISCONNECT USING SQLCA ;

SQLCA.DBMS = ProfileString(gs_ini_path, "DataBase", "DBMS", " ")
SQLCA.Database = ProfileString(gs_ini_path, "DataBase", "DataBase", " ")
SQLCA.LogID = ProfileString(gs_ini_path, "DataBase", "LogID", " ")
SQLCA.LogPass = ProfileString(gs_ini_path, "DataBase", "LogPassword", " ")
SQLCA.ServerName = ProfileString(gs_ini_path, "DataBase", "ServerName", " ")
SQLCA.UserID = ProfileString(gs_ini_path, "DataBase", "UserID", " ")
SQLCA.DBPass = ProfileString(gs_ini_path, "DataBase", "DatabasePassword", " ")
SQLCA.Lock = ProfileString(gs_ini_path, "DataBase", "Lock", " ")
SQLCA.DbParm = ProfileString(gs_ini_path, "DataBase", "DbParm", " ")
CONNECT USING SQLCA ;

1