473,382 Members | 1,809 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Difficulty with System.Diagnostics.Process and MySqlDump

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.

Apr 27 '07 #1
1 2510
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]
- mv*@spam.guard.caspershouse.com

<dw***************************@gmail.comwrote in message
news:11********************@b40g2000prd.googlegrou ps.com...
>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.

Apr 28 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: marccruz | last post by:
Given an instance of System.Diagnostics.Process, how can I get the parent process o Given an instance of System.Diagnostics.Process, how can I get the child processes For example, I start a...
1
by: Heiko Besemann | last post by:
Dear group, I created an aspx page using System.Diagnostics.Process() to launch "tracert" from shell and redirect output to Response.Output which prints it as text/plain into my browsers window....
1
by: solex | last post by:
Hello All, Hopefully someone has run into this error. I have written a class(source below) that launches a thread to monitor the StandardOutput of a System.Diagnostics.Process, in particular I...
2
by: andreas | last post by:
hi, In windows xp in the start launch menu when i put notepad "c:\test.txt" i get notepad with test.txt in it. in vb.net when i state system.diagnostics.process.start("notepad.exe" i get...
11
by: Nurit N | last post by:
This is the third newsgroup that I'm posting my problem. I'm sorry for the multiple posts but the matter becoming urgent. I hope this is the right place for it... I have created a very...
0
by: Daniel | last post by:
System.Diagnostics.Process.Start fails on windows server 2003 the process returns process.ExitCode == 0 but executing any process with System.Diagnostics.Process.Start on windows xp works fine....
0
by: Daniel | last post by:
C# windows service freezes on System.Diagnostics.Process.Start(info) When I launch PSCP from a C# windows service and launch pscp 0.53 there are no issues. but when I use C# windows service to...
0
by: Colin Williams | last post by:
I am using the code below to map network drive and then fire up an app in a sub dir of that drive. However when using the file open dialog from that app, drive K: appears just as Network drive K:...
2
by: test3 | last post by:
Hello folks, I'm using System.Diagnostics.Process to start a thirdparty program (that works perfectly when started via command line). I'm using Process.StandardOutput to get the output of the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.