Click here to Skip to main content
15,896,492 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.
C#
try
{
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.Start();
p.WaitForExit(1000 * 60 * 1);
MessageBox.Show("Database created successfully...", "DB Creation", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Script file does not Exists!!!", "DB Createion", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }


Any Idea?
Posted
Updated 6-Nov-14 19:30pm
v2

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
 
Share this answer
 

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

  Print Answers RSS


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