以文本方式查看主题 - 蓝色快车PB俱乐部论坛 (http://pb.besoft.com.cnhttp://pb.besoft.com.cn/bbs/index.aspindex.asp) -- PowerBuilder MIS编程 (http://pb.besoft.com.cnhttp://pb.besoft.com.cn/bbs/index.aspbbs.asp?boardid=1) ---- [求助]数据库连接【我找了3天还是没答案,希望大哥们帮帮我】 (http://pb.besoft.com.cnhttp://pb.besoft.com.cn/bbs/index.aspdispbbs.asp?boardid=1&rootid=3335&id=3343) |
-- 作者:linshen_831104 -- 发布时间:2005/10/13 22:38:16 -- [求助]数据库连接【我找了3天还是没答案,希望大哥们帮帮我】 怎么样编程才能实现前台调用后台数据库的数据 |
-- 作者:andytang123 -- 发布时间:2005/10/19 12:58:13 -- 一般可以用odbc接口进行连接。以access为例。先在PowerBuilder界面上,单击工具条上的“DB Profile” 图标,在弹出的Database Profiles窗口中选择ODB ODBC,然后单击“New”按钮,在弹出的Database Profile Setup-ODBC对话框的Profile Name:一栏中输入数据库名,在Data Source:一栏选择数据库名,在User ID:一栏输入sa,单击“OK”按钮,完成数据源文件Profile的建立,可以选择上面的preview栏进行测试,成功后将其复制到程序开始的open事件里去。返回Database Profiles窗口,单击ODB ODBC左侧的加号按钮,在展开的ODB ODBC项下选择数据库名,单击“connect”按钮,这样在PowerBuilder中就可以连接上了。最好找本相关的书看看。其实很简单。 |
-- 作者:booktool -- 发布时间:2005/10/20 9:52:36 -- 可以使用ini配置文件连接,这种发法在开发完成后可以脱离pb如果服务器名改变后直接在配置文件中修改就行了不用再在程序中修改源代码. string ls_inifile="lbm.ini"// 定义一个ini文件 SQLCA.dbms = ProfileString ( ls_inifile, "Database", "DBMS", "MSS Microsoft SQL Server 6.x") SQLCA.database = ProfileString ( ls_inifile, "Database", "Database", "") SQLCA.userid = ProfileString ( ls_inifile, "Database", "UserID", "") SQLCA.dbpass = ProfileString ( ls_inifile, "Database", "DBPass", "") SQLCA.logid = ProfileString ( ls_inifile, "Database", "LogID", "sa") SQLCA.logpass = ProfileString ( ls_inifile, "Database", "LogPassword", "") SQLCA.servername = ProfileString ( ls_inifile, "Database", "Servername", "") lbm.ini文件的内容如下 //数据库连接 lbm.ini pb+sql2000 |
-- 作者:wangyoukuang -- 发布时间:2006/6/19 13:59:49 --
|
"> |