title: Import mysql file with c#
body: <p>I'm using this method to import a mysql file:</p>
  
  <pre><code>     var process = Process.Start(
              new ProcessStartInfo
              {
                  FileName = sqlPath,
                  Arguments =
                      String.Format(
                          "-C -B --host={0} --user={1} --password={2} --database={3} -e \"\\.                  {4}\"",
                          server, user, password, database, filename),
                  ErrorDialog = false,
                  CreateNoWindow = true,
                  UseShellExecute = false,
                  RedirectStandardError = true,
                  RedirectStandardInput = true,
                  RedirectStandardOutput = true,
                  WorkingDirectory = Environment.CurrentDirectory,
              }
              );
  
          process.OutputDataReceived += (o, e) =&gt; Console.Out.WriteLine(e.Data);
          process.ErrorDataReceived += (o, e) =&gt; Console.Error.WriteLine(e.Data);
          process.Start();
          process.BeginErrorReadLine();
          process.BeginOutputReadLine();
          process.StandardInput.Close();
          process.WaitForExit();
  
          return process.ExitCode;
  </code></pre>
  
  <p>But, the process ends before all modifications from sql file are definetely apply (for example insert a lot of rows). I want to wait until all rows are inserted in the database.</p>
  
  <p>Thanks in advance
  Javier</p>