Data Model > Accessing the UNICOM Intelligence Data Model > Working with the Case Data Model > Connecting to the UNICOM Intelligence Data Model > Getting the value of an object property from an ADO connection
 
Getting the value of an object property from an ADO connection
You can use the GetObjectFromConnection method of the UNICOM Intelligence OLE DB Provider's DataLinkHelper class to get the value of an object property from an ADO connection. For example, in Visual Basic:
DataLinkHelper
GetObjectFromConnection(Connection As Object, PropertyName As String) As Object
This method is required because extra calls to AddRef are necessary when getting an object from a connection property. This is because of the way ADO handles object property values.
The object connection properties supported by the ##### are:
MR MDM Document. The MDM document loaded for the connection.
MR CDSC Source. The CDSC Source object to which the is connected.
Example
The following mrScriptBasic code demonstrates using this method:
Const CONNECT_STRING = "Provider=mrOleDB.Provider.2;Initial Catalog=C:\Program Files\IBM\SPSS\DataCollection\7\DDL\Data\Data Collection File\museum.mdd"

Dim DataLinkHelper, Connection, MDM, CDSC

' Get the MDM and CDSC object properties
Set DataLinkHelper = CreateObject("mrOleDB.DataLinkHelper")

Set Connection = CreateObject("ADODB.Connection")
Connection.Open(CONNECT_STRING)

Set MDM = DataLinkHelper.GetObjectFromConnection(Connection, "MR MDM Document")
Set CDSC = DataLinkHelper.GetObjectFromConnection(Connection, "MR CDSC Source")

' Create a list of the MDM Field names
Dim Field, FieldList
For Each Field in MDM.Fields
If FieldList IS NOT NULL Then FieldList = FieldList + ", "
FieldList = FieldList + Field.Name
Next

' Create a list of the CDSC Source properties
Dim Property, PropertyList
For Each Property in CDSC.Properties
If PropertyList IS NOT NULL Then PropertyList = PropertyList + ", "
PropertyList = PropertyList + Property.Name
Next
Requirements
UNICOM Intelligence Data Model
See also
Connection properties
Connecting using an open MDM document
Connecting to case data with and without metadata