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); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)