Skip to main content

This version of the product is no longer supported, and this documentation is no longer updated regularly. See the latest version of this content.Opens in a new tab

Loading Configuration Information

To load the connection information into your program, use the Get method of the ConfigurationManager.AppSettings class. Use the values to build the connection string. Here is the InitConnection method from PhonebookObj:


private void InitConnection()
{
  //Retrieve connection information from the configuration file.
  string server = ConfigurationManager.AppSettings.Get("server");
  string logfile = ConfigurationManager.AppSettings.Get("logfile");
  string port = ConfigurationManager.AppSettings.Get("port");
  string nspace = ConfigurationManager.AppSettings.Get("namespace");
  string user = ConfigurationManager.AppSettings.Get("user");
  string pwd = ConfigurationManager.AppSettings.Get("pwd");
  string cacheConnectStr = "Server = " + server + "; Log File = " + logfile + 
      ";Port = " + port + "; Namespace = " + nspace + "; Password = " + pwd + 
      "; User ID = " + user; 
  
  cnCache = new CacheConnection(cacheConnectStr);
  cnCache.Open();
 }

FeedbackOpens in a new tab