DtoDSN Object
An object representing a Zen DSN.
Properties
DbName
Gets or sets the Dbname associated with the DSN.
Description
Gets or sets the description of the DSN.
Name
Gets or sets the name of the DSN.
OpenMode
Gets or sets the open mode enumeration of the DSN.
See
DSN Open Mode for a list of possible values.
Session
Gets or sets the DtoSession object associated with this DtoDSN object.
Translate
Gets or set the encoding translation, which specifies how character data is translated between the database engine and a client application. This property is an enumeration. See
DSN Translate Option for a list of values.
Methods
None
Remarks
To obtain information about a particular database, use the
DtoDatabase Object .
Examples
To Query the DbName Associated with a DSN
Dim my_session as New DtoSession
my_session.Connect("myserver", "username", "password")
my_dsns = my_session.DSNs
first_dsn = my_dsns.Item(1)
dsn_dbname = first_dsn.DbName
To Add a New DSN
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
Dim NewDSN as New DtoDSN
NewDSN.DbName = "DEMODATA"
NewDSN.Description = "A DSN for the DEMODATA db"
NewDSN.Name = "Demodata_DSN"
result = my_dsns.Add(NewDSN)
To Get or Set the Encoding Translation
Dim m_dtoSession1 As New DtoSession
Dim result As dtoResult
result = m_dtoSession1.Connect("localhost", "", "")
Dim sTranslate As String
Dim iTranslate As Integer
iTranslate = m_dtoSession1.DSNs("DEMODATA").Translate
If iTranslate = 0 Then sTranslate = "None"
If iTranslate = 1 Then sTranslate = "OEM/ANSI Conversion"
If iTranslate = 2 Then sTranslate = "Automatic"
MsgBox "DSN Translate Setting (before change): " & sTranslate
If result = Dto_Success Then
Rem set the encoding translation.
m_dtoSession1.DSNs("DEMODATA").Translate = 1
End If
iTranslate = m_dtoSession1.DSNs("DEMODATA").Translate
If iTranslate = 0 Then sTranslate = "None"
If iTranslate = 1 Then sTranslate = "OEM/ANSI Conversion"
If iTranslate = 2 Then sTranslate = "Automatic"
MsgBox "DSN Translate Setting (after change): " & sTranslate
m_dtoSession1.Disconnect
See Also
This site works best with JavaScript enabled