I'm reading an application configuration file form the code pasted below. My question is if this these setting are not available in the configuration file I need to write the missing entries or the complete configuration file with the default values. Please help me. Thanks in advance
String _ProcessName = Process.GetCurrentProcess().ProcessName;
String _ConfigarationFileName = _ProcessName + ".exe.config";
String _ApplicationStartupPath = Application.StartupPath;
System.Configuration.AppSettingsReader _ConfigurationAppSettings = new System.Configuration.AppSettingsReader();
if (System.IO.File.Exists(System.IO.Path.Combine(_ApplicationStartupPath, _ConfigarationFileName)))
{
try
{
String COMMsDB = (String)_ConfigurationAppSettings.GetValue("TempDatabaseName", Type.GetType("String")); // 'Temp database name
String COMMsServer = (String)_ConfigurationAppSettings.GetValue("TempServerName", Type.GetType("String")); // 'Temp server name
String CDBUserName = (String)_ConfigurationAppSettings.GetValue("TempUserName", Type.GetType("String")); // 'Temp server user id
String CDBPass = (String)_ConfigurationAppSettings.GetValue("TempPassword", Type.GetType("String")); // 'Temp server encrypted password
String COMMsPCName = (String)_ConfigurationAppSettings.GetValue("TempComputerName", Type.GetType("String")); // 'Temp Pc Name for execute
String SP1Name = (String)_ConfigurationAppSettings.GetValue("SP1Name", Type.GetType("String")); // 'Stored procedure one name to execute before starting the transfer process
String SP2Name = (String)_ConfigurationAppSettings.GetValue("SP2Name", Type.GetType("String")); // 'Stored procedure two name to execute before starting the Sales process
String SP3Name = (String)_ConfigurationAppSettings.GetValue("SP3Name", Type.GetType("String")); // 'Stored procedure three name to execute before starting the TransferOrders process
String SP4Name = (String)_ConfigurationAppSettings.GetValue("SP4Name", Type.GetType("String")); // 'Stored procedure four name to execute before starting the Database Copy process
String SP5Name = (String)_ConfigurationAppSettings.GetValue("SP5Name", Type.GetType("String")); // 'Stored procedure four name to execute before Exitting the application
}
catch (Exception ex)
{
MessageBox.Show("Please Check the Configaration File " + ex.Message);
}
}
else
{
MessageBox.Show("Configaration File is Missing");
}