Developer Documentation Library > Data Model > Accessing the UNICOM Intelligence Data Model > Working with the Case Data Model > Accessing case data from third party applications > Displaying the Data Link Properties dialog
 
Displaying the Data Link Properties dialog
You can display the Data Link Properties dialog in your applications using the DisplayWizard method of the DataLinkHelper class of the Provider (mrOleDb). In Visual Basic, for example:
DataLinkHelper
DisplayWizard(Optional hWndParent As Long,
Optional ConnectionString As String) As String
The method displays the Data Link Properties dialog and returns the connection string entered in the dialog. An empty connection string is returned if Cancel is pressed. An optional connection string can be provided to initialize the settings in the dialog.
You can restrict the CDSCs displayed in the Data Link Properties dialog to those with certain capabilities by presetting the connection string. For example, with the following connection string the Data Link Properties dialog shows only write-enabled CDSCs:
"Provider=mrOleDB.Provider.2;Mode=2"
Valid Mode values include:
Mode=1 (Read)
Mode=2 (Write)
Mode=3 (ReadWrite)
Example 1
This mrScriptBasic example opens the Data Link Properties dialog, connects to the data source, executes a query, and writes out the contents of the ADO recordset. You can run this script using UNICOM Intelligence Professional, or copy and paste the code into a text file that has a .mrs extension and run the file using mrScript Command Line Runner.
Dim DataLinkHelper, ConnectionString
Dim adoConnection, adoRS, Field

' Open the Data Link Properties dialog
Set DataLinkHelper = CreateObject("MROLEDB.DataLinkHelper")
ConnectionString = DataLinkHelper.DisplayWizard()

If ConnectionString = "" Then Exit ' User canceled

' Connect to the data source
Set adoConnection = CreateObject("ADODB.Connection")
adoConnection.Open(ConnectionString)

' Run a query against the data source
Set adoRS = adoConnection.Execute("SELECT respondent.serial FROM vdata")

' Output the contents of the ADO recordset
adoRS.MoveFirst()

Do Until adoRS.EOF
For Each Field in adoRS.Fields
Debug.Log(Field.Value)
Next
adoRS.MoveNext()
Debug.Log("-- END OF ROW --")
Loop

adoConnection.Close()
Example 2
This example is from the DM Query sample Visual Basic application, which is supplied with the UNICOM Intelligence Developer Documentation Library.
Private Function GetConnectionString() As Boolean
Dim DataLinkHelper As New MROLEDBLib.DataLinkHelper
Dim Result As String

Result = DataLinkHelper.DisplayWizard(Me.hWnd)
If Result = "" Then 'User Canceled
GetConnectionString = False
Else
Set ADOConnection = New ADODB.Connection
ADOConnection.ConnectionString = Result
ADOConnection.Open
Set pADOConnection = ADOConnection
GetConnectionString = True
End If

End Function
See also
Accessing case data from third party applications