I am using the enterprise library logging and exception handling.
Currently I开发者_如何学编程 am adding the connection string in the configuration file, and this means that it is static. My problem is that the user may connect to a different database each time depending on his user name. Is there any way to change the connection string at run time?I created a CustomTraceListener
You can set the Connection string at run time by using ConfiguratiomManager class from System.Configuration namaspace as below;
ConfigurationManager.ConnectionStrings[0].ConnectionString = "Your new Connection string";
精彩评论