Sjef
3 years agoOccasional Contributor
Use Variables in the sql connectionstring
Hi there,
I'm using 2 environments and 2 databases:
1 to create the testcases and 1 to execute them
I want to check the results with DBTables Custom queries (SSMS) and I have i.e. next connectionstring:
How CAN I make this string Variable ?
When I login at the ALPHA-environment I want in the string ALPHA and server01
When I login at the BETA-environment I want in the string BETA and server02
Greetings,
Sjef van Irsel
It's not possible within that dialog. However you can use ADO Object and create your own connection string using variables e.g.
function ADOExample() { var AConnection = ADO.CreateConnection(); var dbServer = "Server1"; var dbName = "ALPHA"; AConnection.ConnectionString = "Provider=MSOLEDBSQL19.1; Integrated Security=SSPI; Persist Security Info=False; Initial Catalog=" + dbName + "; Data Source=" + dbServer + "; Use Encryption for Data=False;"; AConnection.Open(); // Do something AConnection.Close(); }