ITPub博客

首页 > Linux操作系统 > Linux操作系统 > asp.net2.0中2种读取web.config数据库连接字符串

asp.net2.0中2种读取web.config数据库连接字符串

原创 Linux操作系统 作者:iDotNetSpace 时间:2009-11-26 13:30:55 0 删除 编辑
方法一:

<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->string myConn = 
System.Configuration.ConfigurationManager.ConnectionStrings[
"sqlConnectionString"].ConnectionString;

方法二:
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->string connString = 
System.Web.Configuration.WebConfigurationManager.ConnectionStrings[
"sqlConnectionString"].ToString();

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/12639172/viewspace-620628/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-01-04

  • 博文量
    2376
  • 访问量
    5766206