3 回答

TA贡献2065条经验 获得超14个赞
您需要添加一个引用System.Configuration,然后使用:
System.Configuration.ConfigurationManager.
ConnectionStrings["connectionStringName"].ConnectionString;

TA贡献1942条经验 获得超3个赞
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 关注
- 645 浏览
添加回答
举报