Get connection string from Connection object? - VisualCron - Forum

Community forum

DJacobsen
2016-05-31T20:56:16Z
For one of my jobs, I want to call a method within a DLL. One of the parameters to pass into the method is a connection string to connect to a SQL server. I would like to pass in the connection string of a Connection object that was already created. Is there a way to reference one of the existing connectiongs and pull out it's corresponding connection string?

thomas
2016-06-01T08:03:53Z
I dont think so, but you can sort of get around it:

Create user defined variables:
server: {USERVAR(dbserver)}
database: {USERVAR(db)}

finally create a variable that combined the two:
{USERVAR(connstring)} => Data Source={USERVAR(dbserver)};Initial Catalog={USERVAR(db)};Integrated Security=SSPI;

These variables will be available everywhere, so you can pass them around. You can also create connections with variables. Ofcourse, this comes at the expense of security (visible connectionstrings).

Thomas
DJacobsen
2016-06-01T20:44:01Z
That will work for my needs, the security loss isn't an issue as we don't plan on making the security that granular, and it would all be integrated security anyway.
Scroll to Top