IBM®
Skip to main content
    Country/region select      Terms of use
 
 
   
     Home      Products      Services & solutions      Support & downloads      My account     
 
developerWorks
AIX and UNIX
Information Mgmt
Lotus
New to Lotus
Products
How to buy
Downloads
Live demos
Technical library
Training
Support
Forums & community
Events
Rational
Tivoli
WebSphere
Java™ technology
Linux
Open source
SOA and Web services
Web development
XML
My developerWorks
About dW
Submit content
Feedback



developerWorks  >  Lotus  >  Forums & community  >  Lotus Sandbox

Lotus Sandbox

developerWorks
User Review of Add System DBs
Submitted by Nikhil Prabhakar on 08/30/2000.
Comment
Thanks to Zeff Wheelock for the modified code -
1) Move the sysfile()'s before the While...Wend since you do not have to
redefine it each time you go around the loop
2) Get rid of the On error goto and the error routine and replace it with:

Dim testdb As New NotesDatabase("","")
If ( testdb.Open( tserver , sysfile( syscount ) ) ) Then
Call ws.AddDatabase( tserver , sysfile( syscount ) )
Else
Call item.AppendToTextList( "Could not add " &
sysfile(syscount) & " on server " & tserver & ": " & Error$() & Chr(13) )
Call doc.Save( False, True )
End If
3) change doc.save(false,true) to uidoc.save

Here is the modified code:

Sub Click(Source As Button)
Dim s As New notessession
Dim ws As New notesuiworkspace
Dim db As New notesdatabase("","")
Dim doc As notesdocument
Dim tdoc As notesdocument
Dim nab As Variant
Dim sview As notesview
Dim coll As notesdocumentcollection
Dim uidoc As notesuidocument
Dim servername As String
Dim nabname As String
Dim tserver As String
Dim item As notesitem
Dim sysfile(4) As String
Dim syscount As Integer

Set uidoc = ws.currentdocument
Set doc = uidoc.document
servername = doc.ServerName(0)
nabname = doc.NABName(0)

Call db.open(servername,nabname)
Set sview = db.getview("Server\Servers")
Set tdoc = sview.getfirstdocument

Set item = doc.GetFirstItem( "Audit" )

sysfile(0) = "mail.box"
sysfile(1) = "log.nsf"
sysfile(2) = "smtp.box"
sysfile(3) = "smtpibwq.nsf"
sysfile(4) = "smtpobwq.nsf"

While Not ( tdoc Is Nothing )

tserver = tdoc.ServerName(0)
syscount = 0

Forall x In sysfile
Dim testdb As New NotesDatabase("","")
If ( testdb.Open( tserver , sysfile( syscount ) ) ) Then
Call ws.AddDatabase( tserver , sysfile( syscount ) )
Else
Call item.AppendToTextList( "Could not add " &
sysfile(syscount) & " on server " & tserver & ": " & Error$() & Chr(13) )
End If
syscount = syscount + 1
End Forall

Set tdoc = sview.getnextdocument( tdoc )
Wend
Call uidoc.Save
End Sub

Go back

Lotus Software

Document options
Print view

  Sandbox views
By Application Name
By Category
By Product
By Audience
By Date
By Submitter
Conferences

  Resources
developerWorks: Lotus Downloads
alphaWorks Downloads
    About IBM Privacy Contact