11-19-2012 06:21 PM
With this code I can get MySQL to launch but does not recognize it as a valid statement in my C# program. It just shows prints out its help file:
System("Mysql –h localhost –u me –password=pw < LoadDB.cmd");
Solved! Go to Solution.
11-19-2012 06:22 PM
It works fine from the command line as :
Mysql –h localhost –u me –password=pw < LoadDB.cmd
11-20-2012 09:11 AM
Hey erdc3,
It appears that the System() command has been replaced with the Process.Start() command in C#. Here's an MSDN resource page on that command:
http://msdn.microsoft.com/en-us/library/aa326952(v=vs.71).aspx
I'd suggest trying that command. If you still have problems getting it to work, let us know!
11-20-2012 09:39 AM
11-20-2012 09:50 AM
May be you should try it in the appropriate forum... This one here is about LabWindows/CVI, not C#
11-20-2012 09:52 AM
I am trying to make this work in my LabWindows/CVI code. Am I wrong to think that LabWindows/CVI uses C#? If not, what kind of C programing is it then?
11-20-2012 09:58 AM
@erdc3 wrote:
Am I wrong to think that LabWindows/CVI uses C#?
Yes.
If not, what kind of C programing is it then?
11-20-2012 10:01 AM
Thanks, now I know.
But now knowing that, just what code in ANSI C should I use to execute a system command as shown in my first post?
11-20-2012 10:12 AM
There are three options:
If you want to wait for the program to exit, use the system () function in the ANSI C Library. If you want the function to return without waiting for the started program to exit, use LaunchExecutable (). If you also want to monitor whether the launched executable has terminated, use LaunchExecutableEx ().
11-20-2012 04:49 PM
I have used the LaunchExecutable () to successfully start up the data base, then what I do is send a command of:
FmtOut (“%S”, “USE MY_DATABASE\r\n”);
To send to the command line and followed by a carriage return, and it shows up as such, but nothing happens. It does not give me the myscl> prompt. Back. I have to actually hit the enter key to get the prompt back, but the command never gets executed. But then if I just type in from the keyboard USE MY_DATABASE it works.
How strange.
Thank you for your support you have been giving me, I am almost there. Must be some formatting I am doing wrong here?