Get connection string from Connection object? - VisualCron - Forum

Community forum

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?

Forum information
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).

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