开发者

Enterprise library logging + dynamic connection string

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";
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜