Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Reading Web.config / App.config settings (See related posts)

// VB.NET 2.0

#If DEBUG Then
    Private Shared _strConnectionString As String = My.Settings.Item("ConnStringDebug")
#Else
    Private shared _strConnectionString As String = My.Settings.Item("ConnString")
#End If


// Web.Config/App.config file:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

	<appSettings>
		<add key="ConnStringDebug" value="Data Source=time01;Initial Catalog=CWBIOSVRdave;UID=sa; PWD=Clockwatch" />
		<add key="ConnString" value="Data Source=time01;Initial Catalog=CWBIOSVRdave;UID=sa; PWD=Clockwatch"/>
	</appSettings>
</configuration>

You need to create an account or log in to post comments to this site.


Click here to browse all 5147 code snippets

Related Posts