mardi 8 septembre 2015

C# Command Line Process Not outputting to CSV

I have the following method:

 private void updateCSV(string outPut, string dbDir)
        {
            string arguments = "/C "+ outPut + "sqlite3.exe -header -csv " + dbDir + "runs.db 'select * from Runs;' >" + outPut + "dataout.csv"; 

            System.Diagnostics.Process proc = new System.Diagnostics.Process();
            proc.StartInfo.FileName = "cmd.exe";
            proc.StartInfo.Arguments = arguments;               
            proc.StartInfo.CreateNoWindow = true;
            proc.StartInfo.UseShellExecute = false;
            proc.StartInfo.RedirectStandardError = true;
            proc.StartInfo.RedirectStandardOutput = true;
            proc.Start();
            proc.WaitForExit();              


        }

I am simply attempting to output a sqlite3 database into a csv file. The command works outside the c# code but with the C# Diagnostics.Process it makes the CSV file but doesn't input any of the data inside it.

Aucun commentaire:

Enregistrer un commentaire