Click here for Vacation Photos

Archive for the 'C# / VS' Category

DBconn config file

Thursday, June 19th, 2008

An application configuration file follows a specific XML schema. The appSettings section is a predefined section of the configuration file designed to make it very easy to retrieve a value based on a given name. This is the easiest way to add application-specific settings into an application configuration file. The appSettings section of the configuration file consists of a series of “add” elements with “key” and “value” attributes. While the appSettings section is predefined, it is not included in a configuration file by default and must be manually added.

A simple example of a configuration file would be the following:

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

The AppSettings property of the ConfigurationSettings object in the System.Configuration namespace is used to get the settings.

For example, to read either of the settings above,
the following sample code would do the trick:

// Read appSettings string title = ConfigurationSettings.AppSettings[”ApplicationTitle”];

string connectString = ConfigurationSettings.AppSettings[”ConnectionString”];

Now, you could easily set a dynamic title value or read database connection string information from the application configuration file. This gives you the freedom to adjust settings without having to recompile any code. then just pass it into say a SQL connection like so :

SQLConnection cnn = new SQLConnection ( connectString );
// there ya go !

Code Access

Friday, June 13th, 2008

Role Management

Friday, June 13th, 2008

Code Security

Friday, June 13th, 2008

openWYSIWYG

Monday, June 9th, 2008

AutoRun

Saturday, March 22nd, 2008

Globalization and Localization Facts

Saturday, March 15th, 2008

Application ToolTip

Saturday, March 15th, 2008

Configure a Web Service Client

Saturday, March 15th, 2008

Open ID

Friday, February 22nd, 2008

COM Facts

Saturday, February 9th, 2008

XML Basics

Saturday, February 9th, 2008