Creating and Maintaining Catalogs and Dictionaries with DTO : DtoDatabases Collection
 
DtoDatabases Collection
Properties
 
Count
Returns the number of members in a collection.
Item
Returns a specific member of a DtoDatabases collection.
Methods
Add method
Remove method
Remarks
Use the Count property to find the number of members in the collection.
Example
’ instantiate session object and connect to a server
Dim my_session as New DtoSession
Dim result as DtoResult
result = my_session.Connect("myserver", "username", "password")
 
’ now use your session object to obtain db collection
Dim my_databases as DtoDatabases
Set my_databases = my_session.Databases
See Also
DtoDatabase Object
DtoSession Object
Methods Detail
Add method
Add an item to a DtoDatabases collection.
Syntax
result = Collection.Add(Object,[dsnName])
Arguments
Collection
DtoDatabases collection to which to add object.
Object
A new DtoDatabase object
dsnName
optional - will create a standard server DSN for the new database
Return Values
result
DtoResult long value indicating the result of the method call. Use the Error property of the DtoSession Object to obtain a description for the result.
Remarks
This method takes a parameter of type object. Therefore, you are responsible for first instantiating the object and setting its properties before adding it to the collection.
This method will add the given database to the collection and to the underlying DBNAMES.CFG file on the server.
Example
Dim result As dtoResult
Dim database As DtoDatabase
 
Set database = New DtoDatabase
' Set properties for new database
database.Name = "MyDemodata"
database.DdfPath = "C:\test"
database.DataPath = "C:\test"
database.Flags = dtoDbFlagCreateDDF + dtoDbFlagRI
 
result = my_session.Databases.Add(database)
If NOT result = Dto_Success Then
MsgBox "Error"+ Session.Error(result)
End If
Remove method
Removes an item from a DtoDatabases collection.
Syntax
Collection.Remove(database,[deleteDDF])
Arguments
Collection
Collection from which to remove object.
database
A variant that can contain the index (starting with 1) or the database name of the item you wish to remove from the collection
deleteDDF
Set to True to delete dictionary files.
Set to False to leave dictionary files intact.
Return Values
result
DtoResult long value indicating the result of the method call. Use the Error property of the DtoSession Object to obtain a description for the result.
Remarks
This method removes the item from the databases collection and from the underlying DBNAMES.CFG file.
Example
Dim result As dtoResult
result = my_session.Databases.Remove("MyDemodata",1)
If NOT result = Dto_Success Then
MsgBox "Error"+ my_session.Error(result)
End If