Contributions
Re: Variable for connection string or Data Source Name?
Tanya, I tried doing exactly as you had scripted above. Yet the Connection String is not getting updated. eval ("DBTables."+tableName+".ConnectionString = "+Chr(34)+newConnectionString+Chr(34)) log.message (DBTables.lockedrecords.ConnectionString) In line 2 of the script snippet pasted above, I still get the old connection string. I actually want to do a DB Table checkpoint after changing to the new connection string. eval ("DBTables."+tableName+".ConnectionString = "+Chr(34)+newConnectionString+Chr(34)) eval("DBTables."+tableName+".Check") Checkpoint in line 2 is never working as per the new connection string . I am using latest version of TestComplete. Please help. TanyaYatskovska wrote: Hi Elliot, Thanks for sharing your solution with us! I'd like to add that there is a suggestion to use project variables when specifying a connection, and your request has increased its rating! Besides, the following sample may be helpful as well. It iterates through the DBTables collection and changes the needed connection string: function UpdateConnectionString() { //Obtain a collection of the DBTable elements using the aqObject.GetProperties method var props = aqObject.GetProperties(DBTables); var prop; var tableName; var newConnectionString = <my connection string>; //If you use a project variable to keep the new connection string (for example, called myConnectionString), use the following line instead: //var newConnectionString = Project.Variables.myConnectionString; while (props.HasNext()) { //Move to the next property prop = props.Next(); //Obtain the table name tableName = prop.Name; //Use the eval function to assign a new value to the table's ConnectionString property eval("DBTables." + tableName + ".ConnectionString = newConnectionString"); } }2.7KViews0likes1Comment