[RESOLVED] SQLCMD does not continue as long as my calling application process live
Hi all,
I have a c# application calling a SQLCMD for a long .sql file of 80 MB. When I start the application, SQLCMD creates the database and insert first few thousands of records but then it freezes until I kill the process of my application which calls the SQLCMD. As soon as I kill the application, SQLCMD keeps inserting the rest of the records
My code is as below
Code:
string fileName = @mevcut_adres + @"\sqlscripts\" + @klasor_adi + @"\script.sql";
ProcessStartInfo info = new ProcessStartInfo("sqlcmd", @"-A -S " + @sql_server_list.Text + " -U " + @kullanici_adi.Text + " -P " + @kullanici_sifre.Text + " -i \"" + @fileName + "\"");
info.UseShellExecute = false;
info.CreateNoWindow = true;
info.WindowStyle = ProcessWindowStyle.Hidden;
info.RedirectStandardOutput = true;
using (Process exeProcess = Process.Start(info))
{
exeProcess.WaitForExit();
}
Any ideas why this may happen?
Many thanks.
Re: SQLCMD does not continue as long as my calling application process live
Found the problem. It is the "info.RedirectStandardOutput = true;" line. I changed it to false and the problem is solved. Many thanks