04-28-2016 01:46 PM
I'm writing scripts that all need to update an external database. Previously (VBScript) this included 1 "INCLUDE" script that only provided the connection details. It seems like that's the way the "Connection Strings" button is supposed to work, but I haven't yet made it be successful. Any sample code or helpful hints would be greatly appreciated.
Thanks in advance!
-Michael S.
04-29-2016 05:21 AM
Hi Michael,
Once you have created a connection string in the Studio, to use it in a Unity script, just do this:
var dbConnection = app.Configuration.GetConnection("name_of_connection");
This will return the generic DbConnection class
If you need to use a specific connection type (for example SqlConnection or OdbcConnection), you can cast it like this:
var sqlConn = (SqlConnection)app.Configuration.GetConnection("name_of_connection");
Hope that helps!
-Scott
04-29-2016 05:21 AM
Hi Michael,
Once you have created a connection string in the Studio, to use it in a Unity script, just do this:
var dbConnection = app.Configuration.GetConnection("name_of_connection");
This will return the generic DbConnection class
If you need to use a specific connection type (for example SqlConnection or OdbcConnection), you can cast it like this:
var sqlConn = (SqlConnection)app.Configuration.GetConnection("name_of_connection");
Hope that helps!
-Scott
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.