Without knowing what is going wrong (you say it is not working as
expected for you, but what exactly is wrong) it's impossible to say.
Can you clarify?
--
- Nicholas Paldino [.NET/C# MVP]
-
(E-Mail Removed)
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I am trying to automate a mysqldump backup through C# and for some
> reason the System.Diagnostics.Process is just not working as expected
> for me.
>
> What I want is for the following code to start a mysqldump, wait there
> until it finishes, and then continue the loop.
>
> foreach (DataRow dataRow in backupdt.Rows)
> {
> System.Diagnostics.Process proc = new
> System.Diagnostics.Process();
> proc.EnableRaisingEvents=false;
> backupFilename = "c:\\data\\" +
> dataRow["EntBkpSrvName"].ToString() + "." +
> dataRow["EntBkpDbName"].ToString() + "." +
> DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() +
> DateTime.Now.Day.ToString();
> dumpString = " -h" + dataRow["EntBkpSrvIP"].ToString() + " -
> uusername -ppassword " + dataRow["EntBkpDbName"].ToString() + " > " +
> backupFilename + ".sql";
> proc.StartInfo.FileName = "mysqldump.exe";
> proc.StartInfo.Arguments = dumpString;
> proc.Start();
> proc.WaitForExit();
> }
>
>
> Can someone tell me what I'm doing wrong?
>
> Thanks.
>