Click here to Skip to main content
15,881,600 members
Articles / Programming Languages / XSLT

Custom Configuration SQL Connection String Section

Rate me:
Please Sign up or sign in to vote.
3.42/5 (7 votes)
23 Jan 2006CPOL5 min read 90.2K   1K   24  
This solution demonstrates enforcing valid SQL connection strings in the App.Config file.
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>SqlConnection Strings</title>
		<style type="text/css">
			TABLE {
				BORDER-COLLAPSE: collapse;
				TABLE-LAYOUT: fixed;
			}
			TH {
				FONT-WEIGHT: bold; FONT-SIZE: larger; FONT-FAMILY: Verdana, Arial, Helvetica, Sans-Serif;
				BORDER-BOTTOM: black 1px solid;
			}
			TD {
				BORDER-BOTTOM: 0x111111 1px solid;
				FONT-FAMILY: Verdana, Arial, Helvetica, Sans-Serif;
			}
			TD.Required {
				BORDER-LEFT: 0x222222 2px solid;
				TEXT-TRANSFORM: uppercase;
			}
			TD.SqlConnectionString {
				BORDER-LEFT: 0x222222 2px solid;
				FONT-WEIGHT: bold; FONT-FAMILY: "Courier New", Courier, Mono;
			}
			</style>
	</head>
	<body>
		<table border="0" cellpadding="2" cellspacing="0">
			<tr>
				<th align="left" width="150">Key</th>
				<th style="BORDER-LEFT: 0x222222 2px solid;" align="center" width="100">Required</th>
				<th style="BORDER-LEFT: 0x222222 2px solid;" align="left">SqlConnection String</th>
			</tr>
			<tr>
				<td align="left">Primary DSN</td>
				<td class="Required" align="center">true</td>
				<td class="SqlConnectionString" align="left">Integrated Security=True; Database=MYDATABASE; Server=(local);</td>
			</tr>
			<tr>
				<td align="left">Secondary DSN</td>
				<td class="Required" align="center">false</td>
				<td class="SqlConnectionString" align="left">Integrated Security=True; Database=MYDATABASE; Server=MYSERVER,2433;</td>
			</tr>
			<tr>
				<td align="left">Log DSN</td>
				<td class="Required" align="center">false</td>
				<td class="SqlConnectionString" align="left">User ID=MYLOGIN; Connection Timeout=15; Current Language=us_english; Database=MYDATABASE; AttachDBFilename=c:\FileName; Application Name=MYAPPLICATION; Workstation ID=MYWORKSTATION; Network Address=192.168.1.1;</td>
			</tr>
			<tr>
				<td align="left">Backup DSN</td>
				<td class="Required" align="center">true</td>
				<td class="SqlConnectionString" align="left">Persist Security Info=True; User ID=MYLOGIN; Password=MYPASSWORD; Max Pool Size=99; Encrypt=true; Network Library=dbmsgnet; Packet Size=4096; Connection Timeout=15; Database=MYDATABASE; AttachDBFilename=c:\FileName; Network Address=192.168.1.1,2433;</td>
			</tr>
		</table>
	</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Canada Canada
Very experienced Senior Software Developer/Manager with natural leadership and proven project management skills.

Started in Civil Engineering leading the integration of PC's into the Engineering process as a Design/Drafting Technician as well as an in-house Software Developer then transitioned into a full time Software Development career in the early 90's.

Ability to change and adapt has led to diverse experience with a wide array of technology and roles from graphics or web development to designing line of business enterprise applications.

Knowledge Base: Sharepoint, C#, SQL, ASP.NET, C++, CSS, HTML, JavaScript, XML, XSLT

Comments and Discussions