CimDbapTableDSNResponse.DSNAttributes (read-only property)

A list of ODBC driver specific attributes needed to recreate the ODBC DSN
Syntax: String = object.DSNAttributes
Description: This list of attributes is in the form of name=value pairs and are delimited by semicolon. The entire list is terminated with a semicolon (i.e. two semicolons at the end). When using ODBC installer functions, such as SQLConfigDataSource, it will be necessary to replace the semicolons with null bytes. You will also need to add an attribute containing the name of the DSN you wish to configure.



Example:

...
'Add temporary DSN NAME to the list of attributes
Attribs = "DSN=MYDSN;" + oCimDbapTableDSNResponse.DSNAttributes
'Attributes are delimited by semicolon. Replace each with Null byte
Attribs = Replace(Attribs, ";", Chr$(0))
 
'Attempt to create the ODBC Datasource
haveDSN = SQLConfigDataSource(0, ODBC_ADD_DSN, oCimDbapTableDSNResponse.ODBCDriverName, Attribs)
...
'Helper function to replace one delimiter with another
Public Function Replace$(Haystack$, Needle$, Replacement$)
Dim s$
Dim i&
s = Haystack
While InStr(s, Needle) > 0
i = InStr(s, Needle)
If i = 1 Then
s = Replacement & Mid$(s, i + Len(Needle))
Else
s = Left$(s, i - 1) & Replacement & Mid$(s, i + Len(Needle))
End If
Wend
Replace = s
End Function