Click here to Skip to main content
14,742,675 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I wrote an application in C# using VS 2008. The application will run fine in debug mode using Visual Studio, i copied the entire debug folder to some other path the .EXE is not working, nothing happens. I do not get any error messages from windows and there are no errors or warnings in VS. I have tried to build, rebuild and clean the solution (in every possible order) with no luck. Also i tried to attach the process i did't get any error the line executed but no result.

Find the below code which i used.
string FileName = "SqlCmd.exe";
                string element = System.Environment.MachineName + @"\" + "SQLExpress";               

                if (System.IO.File.Exists(Application.StartupPath + @"\EtasFullDBScript.sql"))

                    string Arguments = @" -S " + element + " -i " + System.Windows.Forms.Application.StartupPath + (@"\EtasFullDBScript.sql");                

ProcessStartInfo info = new ProcessStartInfo(FileName, Arguments);
info.UseShellExecute = false;
info.CreateNoWindow = true;
info.WindowStyle = ProcessWindowStyle.Hidden;
info.RedirectStandardOutput = true;
Process p = new Process();
p.StartInfo = info;
p.WaitForExit(1000 * 60 * 1);
MessageBox.Show("Database created successfully...", "DB Creation", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MessageBox.Show("Script file does not Exists!!!", "DB Createion", MessageBoxButtons.OK, MessageBoxIcon.Information);

            catch (Exception ex)

Any Idea?
Updated 6-Nov-14 20:30pm

1 solution

bit difficult to tell from that code - have you

a) thought about adding something like Log4Net to your prog and logging/tracing where the program gets to

b) made sure from where you've copied the debug folder that the program can find artifacts like 'sqlcmd.exe', EtasFullDBScript.sql - you may need to fully specify the path to sqlcmd.exe for example

there will be something small you've missed

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900