SQLCMD does not continue as long as my calling application process live

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
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
<pre class="prettyprint 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();
}[/code]
Any ideas why this may happen?

Many thanks.

View the full article
 
Back
Top