How does one parse the ConnectionString when using RO for .NET. I simply need to change the password as the service starts. In Delphi I accomplished this doing:
lCxnStr := daCxnMgr.Connections.ConnectionByName( gCxnByName ).ConnectionString;
lCxnStringDetails := TDAConnectionStringParser.Create( lCxnStr );
lCxnStringDetails.Password := ‘MyNewPassword’;
How do I do this in RO for .NET (ie Visual Studio
Regards,
Monte
andreyt
(andreyt)
April 15, 2014, 2:55pm
2
Hello Monte.
Please use the next solution:
//using RemObjects.DataAbstract.Server;
var connection = Engine.connectionManager.ConnectionDefinitions[<connection_name>];
string driverName = null;
DataProviderInfo dataProviderInfo = null;
DatabaseProfile profile = null;
RemObjects.Common.Collections.CaseInsensitiveNameValueCollection parameters = null;
string newPassword = "newPassword";
ConnectionStringParser.Parse(connection.ConnectionString, out driverName, out dataProviderInfo, out profile, out parameters);
parameters["Password"] = newPassword;
connection.ConnectionString = ConnectionStringParser.BuildProviderConnectionString(dataProviderInfo,profile,parameters);
Thanks.