2011-12-13 30 views
0

我想訪問.net中lotu notes的catagorized視圖的內容....有人能幫我解決這個問題..我使用的是interop.domino。 DLL。如何使用VB訪問.net中的lotus notes查看內容

Dim s As New Domino.NotesSession 
Dim txt As String 
Dim key() As String = {"abcd", "abcd"} 
s.Initialize("") 
Dim ldb As New NotesDatabase 
ldb = s.GetDatabase("", "", False) 
Dim vw As NotesView 
vw = ldb.GetView("Project Module Wise Configurable Item") 
vw.Refresh() 
Dim entry As NotesViewEntry 
Dim vc As NotesViewEntryCollection 

vc = vw.GetAllEntriesByKey(key, False) 
entry = vc.GetFirstEntry 
While Not (entry Is Nothing) 
    txt = CStr(entry.Item) 
    entry = vc.GetNextEntry(entry) 
    ListBox1.Items.Add(txt) 
End While 
+0

它可以幫助你清理代碼(現在做到這一點),並要求清理代碼中的特定問題 –

+0

@duizendstra感謝......它給上線VC = vw.GetAllEntriesByKey錯誤(關鍵,假) 它沒有獲取數據...是我的代碼正確? –

+0

什麼是錯誤? –

回答

0

嘗試:

Dim s As New Domino.NotesSession 
    s.Initialize("") 

    Dim ldb As New NotesDatabase 
    ldb = s.GetDatabase("", "", False) 

    Dim vw As NotesView 
    vw = ldb.GetView("Project Module Wise Configurable Item") 
    vw.Refresh() 

    Dim txt As String 

    Dim entry As NotesViewEntry 
    Dim vc As NotesViewEntryCollection 

    'declare the array 
' ---- edited ----- 
    Dim key(1) As variant 
'----edited --- 
    key(0) = "abcd" 
    key(1) = "abcd" 

    'be carefull with the second parameter 'false' 
    vc = vw.GetAllEntriesByKey(key, False) 
    entry = vc.GetFirstEntry 
    While Not (entry Is Nothing) 
     txt = CStr(entry.Item) 
     entry = vc.GetNextEntry(entry) 
     ListBox1.Items.Add(txt) 
    End While 
+0

錯誤的變量類型。 (異常來自HRESULT:0x80020008(DISP_E_BADVARTYPE)) 在同一行「vc = vw.GetAllEntriesByKey(key,False)」 –

+0

這是與上面的代碼? –

+0

yes錯誤與上面的代碼 –

0

什麼工作對我來說:聲明密鑰對象的數組。

Dim keys(0 To 1) As Object 
keys(0) = "asdf" 
keys(1) = "sgdk" 
...