sqlconnection - Share DB-connection through service in .NET? -
beginners question: suppose have server on multiple .net services running, use same (configurable) sql-db connection parameters. best way let end user configure connection parameters , share these services?
thanks!
edit: purpose provide gui after installation of services, system admin can set op connection should accesses these services.
taken change web.config programmatically c# (.net)
since you'd have access every service backend iterate through every connection string along lines:
foreach(var service in servicelist) { var configuration = webconfigurationmanager.openwebconfiguration("~"); var section = (connectionstringssection)configuration.getsection("connectionstrings"); section.connectionstrings["myconnectionstring"].connectionstring = "data source=..."; configuration.save(); }
Comments
Post a Comment