Skip to content


Does Smartconnect expose the Connection to the GP database for use in a script?

sid jayawardena asked 8 years ago
In Integration Manager, we can access the database that IM is connected to via the script at the bottom of this post

The advantage is that we will not need to hardcode anything and the script's maintainability becomes so much greater

Does Smartconnect have similar functionality to let us access the connection string for the GP database it is running against?

If not, can we add it to the to do list?
' Created by Mariano Gomez, MVP
' This code is licensed under the Creative Commons 
' Attribution-NonCommercial-ShareAlike 2.5 Generic license.' 
Const adUseClient = 3
Dim oCn
Set oCn = CreateObject("ADODB.Connection")
With oCn  
.ConnectionString = "database=" & GPConnection.GPConnIntercompanyID  
.CursorLocation = adUseClient
End With
Best Answer
Lorren answered 8 years ago

When you create a calculated field, which is a .NET script, on the left hand pane, you can expand the Default Connections option to view the Generic Connections that have been created and the Default GP Connection.

Those connections are then available in that .NET Script.

You can create any connections you want in SmartConnect from the Maintenance Tab and then MSSQL Defaults from the Generic Connector.
Adriaan Davel replied 8 years ago


Where can I see some sample code for doing this?

lorren answered 8 years ago

If you would like to submit an answer or comment, please sign in to the eOne portal.