Reputation: 691
I have this in web.config and i need to use it from vb to pass it on a variable:
<connectionStrings>
<clear/>
<add name="SQL1" connectionString="..." providerName="System.Data.SqlClient"/>
</connectionStrings>
Upvotes: 0
Views: 2863
Reputation: 22076
System.Configuration.ConfigurationManager.ConnectionStrings["SQL1"].ToString();
Upvotes: 0
Reputation: 52241
System.Configuration.ConfigurationManager.ConnectionStrings["SQL1"].ConnectionString
Upvotes: 0
Reputation: 15076
You can use the ConfigurationManager in System.Configuration
ConfigurationManager.ConnectionStrings("cnnName").ConnectionString;
Upvotes: 0
Reputation: 5209
ConfigurationManager.ConnectionStrings("SQL1").ConnectionString.ToString
You'll also need to add Imports System.Configuration
is it's not set at the project level.
Upvotes: 1