Restoring mysqldump file from within c# application Hello all,
I have an unusual request. I am developing a winforms app in C# 2.0
(VS 2005). One of the requirements of this application is giving the
user the ability to choose a mysqldump file and restore it. Right now
I have thrown together the following lines of code to do so:
public bool RestoreMySQL(MySQL ms)
{
string cmd = string.Format(@"-u{0} -p{1} -h{2} {3} <
{4};", ms.UserName, ms.PassWord, ms.DbServer, ms.DbName, FilePath);
Process proc = new Process();
proc.EnableRaisingEvents = false;
proc.StartInfo.FileName = "mysql.exe";
proc.StartInfo.Arguments = cmd;
proc.StartInfo.ToString();
bool result = proc.Start();
return result;
}
(I know it's ugly right now. I am just trying to get it to work in
ideal situations then I will handle exceptions etc.)
This however does not work. I tried to step this to see what is
getting run in the command line but have yet to see a way to do so.The
screen flies by way too fast to read.
Does anybody either know what I am doing wrong here or, even better,
know a way to accomplish this without using a process.
Thanks in advance!
rbr |