using System;

namespace testconfigclass
{
	public class ConfigInfo : System.Configuration.
		NameValueFileSectionHandler
	{
		static string sCS;
		string iCS;
		
		public ConfigInfo()
		{
		}

		public ConfigInfo(string config,
			string element)
		{
			System.Collections.
				Specialized.NameValueCollection
				nvh;
			nvh = (System.Collections.
				Specialized.NameValueCollection)
				System.Web.HttpContext.
				GetAppConfig(config);
			iCS = nvh[element];
		}

		public static string ConnectionString
		{
			get
			{
				if ( sCS == null || sCS == "")
				{
					System.Collections.
						Specialized.NameValueCollection
						nvh;
					nvh = (System.Collections.
						Specialized.NameValueCollection)
						System.Web.HttpContext.
						GetAppConfig("dbConfig");
					sCS = "server=" + nvh["server"]
						+ ";database=" +
						nvh["database"] +
						";uid=sa;pwd=;";
				}
				return sCS;
			}
		}

		public static string operator + (ConfigInfo	cdb)
		{
			return cdb.iCS;
		}
	}
}

