challengeAccepted
challengeAccepted

Reputation: 7600

Difference between connection strings in App Settings and connectionStrings configuration setting

I was wondering what is the difference in having connection strings in 2 app settings and connectionstrings? Just wanted to know technically in Visual Studio 2008 for windows authentication!

<appSettings>
    add key="ConnectionString" value="Server=198.57.2.70;Database=SalesTracking;Integrated Security=SSPI"  />       
</appSettings>

<connectionStrings>
<add name="ConnectionString" connectionString="DataSource=198.57.2.70;InitialCatalog=SalesTracking;IntegratedSecurity=True;" />
</connectionStrings>

Thanks!!

Upvotes: 5

Views: 4367

Answers (1)

TGH
TGH

Reputation: 39258

The difference is that the connectionString section gives you strongly typed access to your connection strings through the ConfigurationManager class. It's meant for connection strings specifically.

AppSettings is meant to store general settings. You can use it to store connection strings, but I recommend not doing that since there is a specific element for it in connectionStrings

Upvotes: 3

Related Questions