<script type=”text/javascript”> </script> <script type=”text/javascript” src=”http://pagead2.googlesyndication.com/pagead/show_ads.js”> </script>
动态的连接到数据库的方法:
这里我们创建一个后缀为Ini的文件system.ini,在system.Ini文件中写入如下代码:
[DBMS_PROFILES]
CURRENT=ODBC
PROFILES=
[Profile ]
DBMS=
Database=
UserId=
DatabasePassword=
LogPassword=
ServerName=
LogId=
Lock=
DbParm=ConnectString=’DSN=ora8;UID=;PWD=’ //ora8指数据库服务器名
Prompt=0
AutoCommit=0
这样在应用程序的open事件中写入下代码:
string ls_inifile
ls_inifile = “system.ini”
// Profile system
SQLCA.DBMS =ProfileString(ls_inifile,”Database”, “DBMS”, “”)
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”, “”)
SQLCA.LogPass =ProfileString(ls_inifile,”Database”, “LogPassWord”,””)
SQLCA.ServerName =ProfileString(ls_inifile,”Database”, “ServerName” ,””)
SQLCA.DBParm =ProfileString(ls_inifile,”Database”, “DBParm”, “”)
Connect using sqlca;
open(w_frame)
If sqlca.sqlcode<>0 then
Messagebox(“不能连接到数据库“,Sqlca.sqlerrtext)
return
end if
*****代码测试通过Pb8.0
<script type=”text/javascript”> </script> <script type=”text/javascript” src=”http://pagead2.googlesyndication.com/pagead/show_ads.js”> </script>
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/35826.html