(2)在Command1一的Click中加入:
Private Sub Command1_Click()
Debug.Print "----------------- Test Start -------------------"
If getDBConfig("app1") then
Debug.Print "---------------- Test OK --------------------"
Else
Debug.Print "---------------- Test Error --------------------"
End if
End Sub
三、 修改VBàLotus Script
修改后Lotus Script如下 :
'-----------------------------------------------------------------------------
' File: DBCONFIG.LSS
' Copyright (c) 2001-2005
' Language : LotusScript
' Description: Global Constants for connect to Oracle DB.
' The PG use a XML file named DBConfig.xml to config DB connections for appliction.
' Useage : (1) Declaration : %include "DBconfig.lss"
' (2) Code :
' Dim AppName, uid, pwd, tns , index
' index = getDBConfig(appName)
' if index then
' 'AppName = DBConfig(index).AppName
' 'uid = DBConfig(index).DB_UID
' 'pwd = DBConfig(index).DB_PWD
' 'tns = DBConfig(v).DB_TNS
'
' uid = DB_UID
' pwd = DB_PWD
' tns = DB_TNS
' else
' msgbox (" The appName wasn't found.")
' end if
'
'-----------------------------------------------------------------------------
' Structure for keep xml APPLICATION
Public Type XMLForDB
AppName As String
DB_UID As String
DB_PWD As String
DB_TNS As String
End Type
' Keep xml file content
Public DBConfig() As XMLForDB
' DB connection
Public DB_UID As String
Public DB_PWD As String
Public DB_TNS As String
Public DB_Result As Integer
Const XMLPATH = "D:\Lotus\Domino\DBConfig.xml"
'