DtoDSNs Collection
A collection of DtoDSN objects.
Properties
Count | Returns the number of members in a collection. |
Item | Returns a specific member of a DtoDSNs collection. |
Methods
Remarks
Use the Count property to find the number of members in the collection.
Example
Dim my_session as New DtoSession
Dim result as DtoResult
result = my_session.Connect("myserver", "username", "password")
Dim my_dsns as DtoDSNs
Set my_dsns = my_session.DSNs
See Also
Methods Detail
Add method
Add an item to a DtoDSNs collection and creates a DSN on the server.
Syntax
result = Collection.Add(Object)
Arguments
Collection | DtoDSNs collection to which to add object. |
Object | A new DtoDSN object |
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.
Example
Dim result As dtoResult
Dim DSNs As DtoDSNs
Dim dsn As DtoDSN
Set dsn = New DtoDSN
dsn.Name = "MyDemodata_DSN"
dsn.Description = "a sample DSN"
dsn.Dbname = "MyDemodata"
dsn.Openmode = dtoNormalDSNOpenMode
result = my_session.DSNs.Add(dsn)
If NOT result = Dto_Success Then
MsgBox "Error"+ my_session.Error(result)
End If
Remove method
Removes a DSN item from a DtoDSNs collection and deletes it from the server.
Syntax
result = Collection.Remove(dsn)
Arguments
Collection | Collection from which to remove object. |
dsn | A variant containing either the index (starting with 1) or the name of the item you wish to remove from the collection |
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 does not remove the associated database or database name.
Example
Dim result As dtoResult
Dim DSNs As DtoDSNs
result = my_session.DSNs.Remove("MYDSN")
If NOT result = Dto_Success Then
MsgBox "Error"+ my_session.Error(result)
End If