PC Review


Reply
Thread Tools Rate Thread

Difficulty with System.Diagnostics.Process and MySqlDump

 
 
dwcscreenwriterextremesupreme@gmail.com
Guest
Posts: n/a
 
      27th Apr 2007
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.

 
Reply With Quote
 
 
 
 
Nicholas Paldino [.NET/C# MVP]
Guest
Posts: n/a
 
      28th Apr 2007
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.
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
what permissions does a windows service need to execute another process? System.Diagnostics.Process process = System.Diagnostics.Process.Start(info); just local administrator? any specific permitions? Daniel Microsoft Windows 2000 Networking 1 13th Apr 2006 08:58 AM
what permissions does a windows service need to execute another process? System.Diagnostics.Process process = System.Diagnostics.Process.Start(info); just local administrator? any specific permitions? Daniel Microsoft Dot NET Framework 1 13th Apr 2006 04:56 AM
what permissions does a windows service need to execute another process? System.Diagnostics.Process process = System.Diagnostics.Process.Start(info); just local administrator? any specific permitions? Daniel Microsoft Windows 2000 Security 0 12th Apr 2006 11:47 PM
what permissions does a windows service need to execute another process? System.Diagnostics.Process process = System.Diagnostics.Process.Start(info); just local administrator? any specific permitions? Daniel Microsoft C# .NET 0 12th Apr 2006 11:47 PM
what permissions does a windows service need to execute another process? System.Diagnostics.Process process = System.Diagnostics.Process.Start(info); just local administrator? any specific permitions? Daniel Microsoft Dot NET 0 12th Apr 2006 11:46 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:30 AM.