再会!我想问一下,如果您知道如何修改 web.config.. 它位于不同的文件夹中.. 我尝试使用这种方法,不幸的是我不起作用..
// set Path to your config file
System.Configuration.ConfigurationFileMap fileMap = new ConfigurationFileMap(sWebConfig);
// open web.config
System.Configuration.Configuration configuration = System.Configuration.ConfigurationManager.OpenMappedMachineConfiguration(fileMap);
// display message
Console.WriteLine("Updating wizardConnection string.. Please wait for a few minutes..");
// fetch WizardConnection database connection string
var Wizardsection = (ConnectionStringsSection)configuration.GetSection("WizardConnection");
// assign new value to wizardConnection.. Please make sure you have the correct database server. Just update server location, if need
Wizardsection.ConnectionStrings["WizardConnection"].ConnectionString = string.Format(@"server={0};database={1};integrated security=SSPI", sDatabaseServer, sDatabase);
configuration.Save();
希望早日收到你的消息..
问候,
关联