Programming Journal C#, Java, SQL and to a lesser extent HTML, CSS, XML, and regex. I made this so other programmers could benefit from my experience.

Saturday, August 15, 2009

Use a Class to Store ConnectionString

This appears the best way to store database ConnectionString objects in a given Class:


internal static string GetConnectionString(string specifiedConnectionString, bool lookupConnectionString, bool appLevel)
{
//Your Conn String goes here!!
return Factory.ConnectionString;
}

Notice that a static Class is used since we don't need to waste memory instantiating strings.

References: http://forums.asp.net/p/997608/2209437.aspx
Specifically mentioned was to modify the SQLConnectionHelper.cs from: http://download.microsoft.com/download/a/b/3/ab3c284b-dc9a-473d-b7e3-33bacfcc8e98/ProviderToolkitSamples.msi

No comments: