asp.net2.0中2種讀取web.config資料庫連線字串

iDotNetSpace發表於2009-11-26
方法一:

<!--

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

--&gtstring myConn = 
System.Configuration.ConfigurationManager.ConnectionStrings[
"sqlConnectionString"].ConnectionString;

方法二:
<!--

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

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

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/12639172/viewspace-620628/,如需轉載,請註明出處,否則將追究法律責任。

相關文章