fiogf49gjkf0d This will reset the connection manager using a COM access. I have needed in high security places where the AttachRemote needs to over riden (it hard code a fixed pwd). We've needed to setup an alternate control seed or based the process on an ever changing key. But this is the core code. It rebuilds the slxoledbconfig.dat in the AppData\SalesLogix folder. You'll need to make an interop.SlxOleDBConfig.dll file as well.
private static void ConfigureSLXConnection(string SQLServer)
{
try
{
interop.SlxOleDBConfig.DBConfigMgr configMgr = new interop.SlxOleDBConfig.DBConfigMgr();
string svConnStr = GetConnectionString("SalesLogix", "sysdba", "masterkey", SQLServer);
try
{
configMgr.DeleteAlias("SalesLogix");
}
catch { }
configMgr.AddAlias("SalesLogix", svConnStr);
configMgr.SetConnMgrInfo("SalesLogix", 51101, ipInternal);
configMgr.SetRWPass(svConnStr, "");
configMgr.SetROPass(svConnStr, "");
}
catch { }
}
private static string GetConnectionString(string dataBase, string userId, string password, string server)
{
StringBuilder sb = new StringBuilder();
sb.Append("Provider=SQLNCLI.1");
sb.Append(";");
sb.Append("Password=");
sb.Append(password);
sb.Append(";");
sb.Append("Persist SecurityInfo=True");
sb.Append(";");
sb.Append("User ID=");
sb.Append(userId);
sb.Append(";");
sb.Append("Initial Catalog=");
sb.Append(dataBase);
sb.Append(";");
sb.Append("Data Source=");
sb.Append(server);
return sb.ToString();
}
} |