3 回答

TA貢獻(xiàn)2065條經(jīng)驗(yàn) 獲得超14個(gè)贊
您需要添加一個(gè)引用System.Configuration,然后使用:
System.Configuration.ConfigurationManager.
ConnectionStrings["connectionStringName"].ConnectionString;

TA貢獻(xiàn)1942條經(jīng)驗(yàn) 獲得超3個(gè)贊
C#
// Add a using directive at the top of your code file
using System.Configuration;
// Within the code body set your variable
string cs = ConfigurationManager.ConnectionStrings["connectionStringName"].ConnectionString;
VB
' Add an Imports statement at the top of your code file
Imports System.Configuration
' Within the code body set your variable
Dim cs as String = ConfigurationManager.ConnectionStrings("connectionStringName").ConnectionString
- 3 回答
- 0 關(guān)注
- 671 瀏覽
添加回答
舉報(bào)