I am using the below string in my code :
string AAR_FilePath = "\"C:\\MySQL\\MySQL Server 5.0\\bin\\mysqldump\"";
which i dont want to hardcore in my code. So i need to use that in my app.config
I tried to give the same value as,
<add key="Path_SqlDump" value="\"C:\\MySQL\\MySQL Server 5.0\\bin\\mysqldump\""></add>
But the above gives me error, because of the quotes.
All i need is, i should be able to assign “\”C:\MySQL\MySQL Server 5.0\bin\mysqldump\””
to a string. HOW ?
public string AAR_FilePath = ConfigurationSettings.AppSettings["Path_SqlDump"].ToString();
public void CreateScript_AAR()
{
//AAR_FilePath = "\"C:\\MySQL\\MySQL Server 5.0\\bin\\mysqldump\"";
string commandLine = @"" + AAR_FilePath + " -u" + DbUid + " -p" + DbPwd + " " + DbName + " > " + Path_Backup + FileName_Backup;
System.Diagnostics.ProcessStartInfo PSI = new System.Diagnostics.ProcessStartInfo("cmd.exe");
PSI.RedirectStandardInput = true;
PSI.RedirectStandardOutput = true;
PSI.RedirectStandardError = true;
PSI.UseShellExecute = false;
System.Diagnostics.Process p = System.Diagnostics.Process.Start(PSI);
System.IO.StreamWriter SW = p.StandardInput;
System.IO.StreamReader SR = p.StandardOutput;
SW.WriteLine(commandLine);
SW.Close();
}
You don’t do all that escaping in the app.config. That is a C# thing. Just put the full path in the app.config as you would in a command prompt.