|
I believe it is new to 2005. Check out FxCop
|
|
|
|
|
A better idea. Get a profiler. This[^] is a fine example of one from RedGate.
|
|
|
|
|
I have a csharp windows application, i am using Mysql database, i need to provide a utility from the application to backup and restore database.
I can run the following commands from the Dos shell, but i need to run the same from the csharp code. I used the folder browser and file dialog to get the path
and created the following string "mysqldump -u root -p XXXX emanage > c:\emanage.sql" . can some one help me out by telling how to run a command from csharp code.
Thanks in advance
|
|
|
|
|
To run a command in DOS generally
System.Diagnostics.Process.Start("cmd", "command comes here"); is used
-- modified at 7:34 Thursday 11th October, 2007
Koushik
|
|
|
|
|
The the above script just opens the dos console and does not run the command in the entered string. How do i run the command automatically.
|
|
|
|
|
Hey why don't u keep the required command in a batch (.bat) file and then run the batch file using..
System.Diagnostics.Process.Start(@"filename");
Koushik
|
|
|
|
|
Thanks for the reply, i did a mistake earlier, i put cmd in the command string and actual command in the parameters, but now its resolved.
Thanks again.
|
|
|
|
|
string ls_path = @"c:\csharpbkp.sql";
System.Diagnostics.Process.Start("mysqldump", "-u root -p emanage >" + ls_path );
why does this not work,
|
|
|
|
|
Probably there is no process or filename by mysqldump ...
Anyhow u got the answer right...
Koushik
|
|
|
|
|
I am using a batch file for now, but there is a process names mysqldump and it works fine on the command prompt and with the batch file.
|
|
|
|
|
<br />
public delegate void updatevalores(int total);<br />
<br />
public partial class FormConexiones : Form<br />
{<br />
private int procesosactuales = 0;<br />
public FormConexiones()<br />
{<br />
InitializeComponent();<br />
}<br />
private void FormConexiones_Load(object sender, EventArgs e)<br />
{<br />
procesos proces = new procesos();<br />
Thread pid = new Thread(new ThreadStart(proces.iniciar(new updatevalores(actualizarv))));<br />
pid.Start();<br />
}<br />
<br />
public void actualizarv(int total)<br />
{<br />
procesosactuales = total;<br />
}<br />
}<br />
Another Class:
class procesos {<br />
{<br />
struct sproceso<br />
{<br />
public int id;<br />
public string NombreProceso;<br />
public string DirProceso;<br />
public string FileProceso;<br />
public DateTime tiempoinicio;<br />
}<br />
ArrayList listaprocesos = new ArrayList();<br />
bool existeproces = false;<br />
bool coincide = false;<br />
Timer nuevotiempo = new Timer();<br />
<br />
public void iniciar(updatevalores procesoact)<br />
{<br />
<br />
nuevotiempo.Elapsed += new ElapsedEventHandler(TiempoEjecutar);<br />
nuevotiempo.Interval = 5000;<br />
nuevotiempo.Enabled = true;<br />
}<br />
<br />
}
The Line Thread pid = new Thread(new ThreadStart(proces.iniciar(new updatevalores(actualizarv)))); has give me an error.
How i can pass values to proces.iniciar method??????????
Thanks
|
|
|
|
|
Hello,
This[^] should help!
All the best,
Martin
|
|
|
|
|
public delegate void updatevalores(int total);<br />
<br />
public partial class FormConexiones : Form<br />
{<br />
private int procesosactuales = 0;<br />
public FormConexiones()<br />
{<br />
InitializeComponent();<br />
}<br />
<br />
private void FormConexiones_Load(object sender, EventArgs e)<br />
{<br />
procesos proces = new procesos();<br />
Thread pid = new Thread(new ParameterizedThreadStart(proces.iniciar));<br />
pid.Start(new updatevalores(actualizarv));<br />
}<br />
public void actualizarv(int total)<br />
{<br />
procesosactuales = total;<br />
}<br />
}
Give me an error with
ParameterizedThreadStart(proces.iniciar)
The error is: none overload correspond 'iniciar' match with 'System.Threading.ParameterizedThreadStart' delegate
what the
|
|
|
|
|
damn
i forget to read:
This is simple, but only accepts a single parameter and isn't type-safe (just like the options when using thread pool threads)
:->
|
|
|
|
|
So you are fine with that?
All the best,
Martin
|
|
|
|
|
Yep
Works Fine:
procesos proces = new procesos();<br />
ThreadStart inipro = delegate { proces.iniciar(new updatevalores(actualizarv)); };<br />
new Thread(inipro).Start();
Ok, so much battle with Thread and asyncronic querys...
time to rest
thanks for all
|
|
|
|
|
Sleep well!
You are wellcome!
All the best,
Martin
|
|
|
|
|
y me getting also feel to sleep..............
a very long conversation to a simple problem...
Thanks and regards
manoj Kumar Jha
|
|
|
|
|
What are webparts?What is the use of webparts
|
|
|
|
|
what is google[^] ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: what is google[^] ?
Oohhh!!! Are we playing Jeopardy now?
|
|
|
|
|
Christian Graus wrote: what is google
I don't know but a simple search on About.com[^] finds the answer! Are you helpless!
|
|
|
|
|
hi all,
how to wrap a text of a item to the next line of listview
if the length is too long?
i found in msdn that the labelwrap property works only if the view mode is set to largeicon or smallicon.
i need to set the view mode to Tile and i need to wrap the text
how is it possible?
Thanks in advance.
Regards
Anuradha
|
|
|
|
|
I think this[^] is what you are looking for.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Hi
I have Windows server 2000 with Terminal Services components installed.
I set ERRORLVEL in C# console application using
System.Environment.Exit(1); OR
System.Environment.ExitCode = 1;
but on dos prompt if i type echo %ERRORLEVEL% , it always returns 0.
I seen on KB from Microsoft-- KB 810146
http://support.microsoft.com/kb/810146
which mentiones that Scripts that check the %errorlevel% system variable may return inconsistent values when run on a Windows 2000-based computer with Terminal Services components installed.
so what is the workaround/soluation for this ? How to set ERRORLEVEL for Windows 2000 with Terminal Services components installed ?
-sandeep
-- modified at 6:19 Thursday 11th October, 2007
|
|
|
|