473,385 Members | 1,796 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,385 software developers and data experts.

Calling exe with parameter doesn't work....

I wish to use an exe file, it looks like this:
System.Diagnostics.Process mysqldump = new System.Diagnostics.Process();

mysqldump.StartInfo.FileName = @"C:\Program Files\MySQL\MySQL
Server 5.0\bin\mysqldump.exe";
Response.Write(File.Exists(mysqldump.StartInfo.Fil eName).ToString());
//just to check if I'm pointing right
mysqldump.StartInfo.Arguments = @"-u myuser --password=mypass
my5 > F:\\MySQL\\Backup\\my5a";

mysqldump.StartInfo.CreateNoWindow = false;
mysqldump.StartInfo.ErrorDialog = true;
mysqldump.StartInfo.RedirectStandardOutput = true;
mysqldump.StartInfo.UseShellExecute = false;
try
{
Response.Write(mysqldump.Start().ToString());
}
catch (Exception exc)
{
Response.Write(exc.Message);
}
I'm gettin True (file exists) and True (Process.Start()) and no
exception is caught, but there is no effect.

If i simply call in shell:
mysqldump -u myuser --password=mypass my5 > F:\\MySQL\\Backup\\my5a
it works fine, backup is created.

What am I doing wrong?

Thanks a lot
Mar 18 '06 #1
5 1696
@"-u myuser --password=mypass > my5 > F:\\MySQL\\Backup\\my5a";

produces :

-u myuser --password=mypass my5 > F:\\MySQL\\Backup\\my5a

as the output, which will fail silently as a bad path.

If you use the @ to create a literal string, remove the double slashes.

Use :

..Arguments =@"-u myuser --password=mypass > my5 > F:\MySQL\Backup\my5a";

OR use :

..Arguments ="-u myuser --password=mypass > my5 > F:\\MySQL\\Backup\\my5a";


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"christof" <no****@nomail.de> wrote in message news:es**************@tk2msftngp13.phx.gbl...
I wish to use an exe file, it looks like this:
System.Diagnostics.Process mysqldump = new System.Diagnostics.Process();

mysqldump.StartInfo.FileName = @"C:\Program Files\MySQL\MySQL Server
5.0\bin\mysqldump.exe";
Response.Write(File.Exists(mysqldump.StartInfo.Fil eName).ToString()); //just to check if I'm
pointing right
mysqldump.StartInfo.Arguments = @"-u myuser --password=mypass my5 >
F:\\MySQL\\Backup\\my5a";

mysqldump.StartInfo.CreateNoWindow = false;
mysqldump.StartInfo.ErrorDialog = true;
mysqldump.StartInfo.RedirectStandardOutput = true;
mysqldump.StartInfo.UseShellExecute = false;
try
{
Response.Write(mysqldump.Start().ToString());
}
catch (Exception exc)
{
Response.Write(exc.Message);
}
I'm gettin True (file exists) and True (Process.Start()) and no exception is caught, but there is
no effect.

If i simply call in shell:
mysqldump -u myuser --password=mypass my5 > F:\\MySQL\\Backup\\my5a
it works fine, backup is created.

What am I doing wrong?

Thanks a lot

Mar 18 '06 #2
Juan T. Llibre wrote:
@"-u myuser --password=mypass > my5 > F:\\MySQL\\Backup\\my5a";

produces :

-u myuser --password=mypass my5 > F:\\MySQL\\Backup\\my5a

as the output, which will fail silently as a bad path.

If you use the @ to create a literal string, remove the double slashes.

Use :

.Arguments =@"-u myuser --password=mypass > my5 > F:\MySQL\Backup\my5a";

OR use :

.Arguments ="-u myuser --password=mypass > my5 > F:\\MySQL\\Backup\\my5a";


I did it especially so I don't think it is a reason:

In windows in shell you have to launch mysqldump like

mysqldump -u user --password=pass db_name > C:\\Dir\\File

with double backslashes or simply:

mysqldump -u user --password=pass db_name > C:/Dir/File

both works fine from shell, so the problem is not here.

Thanks anyway
Mar 18 '06 #3
re:
I did it especially so I don't think it is a reason:
Regardless of whether you "did it especially", the way you're doing it is failing.

Did you test the alternate ways I suggested you do it ?


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"christof" <no****@nomail.de> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl... Juan T. Llibre wrote:
@"-u myuser --password=mypass > my5 > F:\\MySQL\\Backup\\my5a";

produces :

-u myuser --password=mypass my5 > F:\\MySQL\\Backup\\my5a

as the output, which will fail silently as a bad path.

If you use the @ to create a literal string, remove the double slashes.

Use :

.Arguments =@"-u myuser --password=mypass > my5 > F:\MySQL\Backup\my5a";

OR use :

.Arguments ="-u myuser --password=mypass > my5 > F:\\MySQL\\Backup\\my5a";


I did it especially so I don't think it is a reason:

In windows in shell you have to launch mysqldump like

mysqldump -u user --password=pass db_name > C:\\Dir\\File

with double backslashes or simply:

mysqldump -u user --password=pass db_name > C:/Dir/File

both works fine from shell, so the problem is not here.

Thanks anyway

Mar 18 '06 #4
christof wrote:
I wish to use an exe file, it looks like this:

[...cut...]

I experienced the similar problem several times. It's called Mr.
Glowacky's problem and it's probably not yet solved. It's just like
"Hilbert's tenth problem" or even "Goldbach conjecture".

Hope my message will help you :)

Best regards!

maczek
Mar 18 '06 #5
Juan T. Llibre wrote:
re:
I did it especially so I don't think it is a reason:


Regardless of whether you "did it especially", the way you're doing it is failing.

Did you test the alternate ways I suggested you do it ?


Yes, but unfortunately it didn't help, i was suggested to add, this a
line of code:

Response.Write(mysqldump.StandardOutput.ReadToEnd( ));

in my try block and i see the response on the screen, which is generated
normally by mysqldump.exe when i run it from shell, but it's only the
beggining of what i'm getting in the right output backup file.

Looks like this:

-- MySQL dump 10.10 -- -- Host: localhost Database: my5 --
Server version 5.0.15-nt /*!40101 SET ...
[...]
*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

and cuts here. In the proper bakup file, it continues here:

[...]
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `account`
--

DROP TABLE IF EXISTS `account`;
[...]

and so on with sql statements.

Maybe some more suggestions
Thanks

Mar 18 '06 #6

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

Similar topics

4
by: Murat Tasan | last post by:
i have a quick question... is there a way to obtain the reference to the object which called the currently executing method? here is the scenario, i have a class and a field which i would like to...
3
by: StealthMonkey | last post by:
Let me prefix this by saying that I know next to nothing about Java (so please try to keep explainations simple). I use PHP for my server-side web programming. Here is my dilemma: I need a...
6
by: dw | last post by:
Hello all, I'm having a dickens of a time calling a stored procedure on a connection. Every time I do, it generates an error "Arguments are of the wrong type, are out of acceptable range, or are in...
3
by: Cindy Liu | last post by:
Hi Everyone, I created C# COM+ component. It has two overloaded methods - the method names are same and their signatures are different, one takes two parameters and another takes four. I coded...
1
by: Venkat | last post by:
Hi All, I am not able to access a dll function from a remote script using ActiveXobject when an output parameter is used, but i could able to access the same when no output parameter is used....
1
by: Eric Land | last post by:
Help! I'm trying to call a parameterized stored proc in ASP.NET in VB. I am creating a command object and creating a parametr list, and assigning a value from a session variable (this is working)...
7
by: Christian Wilhelm | last post by:
Hi! I'm trying to call a Java WebService out of a .net Client. There are two Methods, one Method requires one Parameter of type Parameter, the other Method requires one Parameter of type...
18
by: John Friedland | last post by:
My problem: I need to call (from C code) an arbitrary C library function, but I don't know until runtime what the function name is, how many parameters are required, and what the parameters are. I...
10
by: sulekhasweety | last post by:
Hi, the following is the definition for calling convention ,which I have seen in a text book, can anyone give a more detailed explanation in terms of ANSI - C "the requirements that a...
6
by: Ole Nielsby | last post by:
VC has a __cdecl specifier which allows functions and methods to be called with varying parameter count. (I understand this is the default for functions in general but in VC, instances use...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
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.