2016-07-12 8 views
0

ライブラリとしてLSクラスがあり、クラスは正常に動作しますが、レプリカIDでデータベースを開く必要があります。私は、以下の方法を使用してLSライブラリ内の他の例でこれを行っているが、ライン:ロータスクラスのReplicaIDでグローバルに定義されたデータベースを開く

Dim tDB As New NotesDatabase(serverName , LogRepID) 

は、実際にデータベースIグローバルLOGDB =はtDBを設定するときに、それが開かれていないとスクリプトが失敗を開きません。 LogRepIDは正しいレプリカIDであり、問​​題なく簡単なLSライブラリで本質的に同じオープンプロセスを実行しました。

Class AgentLog 
    AutoSave As Integer 
    Enabled As Integer 
    LogDoc As NotesDocument 
    LogItem As NotesRichTextItem 
    LogDB As NotesDatabase 
    LogRepID As String 
    LogStyle As NotesRichTextStyle 
    DefaultStyle As NotesRichTextStyle 
    ViewIcon As Integer 
    Errors As Integer 
    mainDB As NotesDatabase 
    serverName As String 
    vwApplication As NotesView 
    appDoc As NotesDocument 
    Sub New(Process As String, pAutoSave, pEnabled) 
     Enabled = Cint(pEnabled) 
     If Enabled Then 
      Dim S As New NotesSession 
      Set mainDB = S.CurrentDatabase 
      serverName = mainDB.Server 
      Set vwApplication = mainDB.getView("vwWFSApplicationsEnabled") 
      Set appDoc = vwApplication.Getdocumentbykey("Admin", True) 
      LogRepID = appDoc.Getitemvalue("agentLogRepID")(0) 
      Dim tDB As New NotesDatabase(serverName , LogRepID) 
      Set LogDB = tDB 
      If LogDB.IsOpen Then 
       Set LogDoc = LogDB.CreateDocument() 
       Call LogDoc.ReplaceItemValue("Form", "frmWFSAgentLog") 

ソリューション:

がにコードを変更:

Dim tDB As New NotesDatabase("" , "") 
tDB.Openbyreplicaid ServerName , LogRepID 
Set LogDB = tDB 

、今ではこれが最善の方法であるかどうかわからない動作しますが、それは動作します。

+0

Not isOpen(tDB)を試しましたか?次に、tDB.Open()を呼び出します。\ n終了しますか?終了しますか? –

答えて

0

これは正しい方法です。

Dim db As New NotesDatabase("", "") 
If db.OpenByReplicaID("Moscow", "85255FA900747B84") Then 
    Print(db.Title & " was successfully opened") 
Else 
    Print("Unable to open database") 
End If 
関連する問題