web.config文件中的C#连接字符串 [英] C# connection string in web.config file
本文介绍了web.config文件中的C#连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在页面后面的代码中,如何访问存储在web.config文件中的连接字符串?
In my code behind page, how do I access the connection string which is stored in my web.config file?
推荐答案
System.Web.Configuration.WebConfigurationManager.ConnectionStrings["YouConnStringName"].ConnectionString;
这需要引用System.Configuration.dll和System.Web.dll。
This requires references to System.Configuration.dll and System.Web.dll.
这篇关于web.config文件中的C#连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文