我在asp.net
是新的,並希望編寫代碼來運行sql server
dtexec
爲目的編寫代碼:
爲什麼我在asp.net中的dtexec命令中出錯?
System.Diagnostics.Process si = new System.Diagnostics.Process();
si.StartInfo.WorkingDirectory = @"c:\";
si.StartInfo.UseShellExecute = false;
si.StartInfo.FileName = "cmd.exe";
si.StartInfo.Arguments = "/C dtexec/f E:/Package.dtsx/set /package.variables[FilePath].Value; e:\testFile.txt";
si.StartInfo.CreateNoWindow = true;
si.StartInfo.RedirectStandardInput = true;
si.StartInfo.RedirectStandardOutput = true;
si.StartInfo.RedirectStandardError = true;
si.Start();
string output = si.StandardOutput.ReadToEnd();
si.Close();
但是當我運行該代碼,出現此錯誤:
Microsoft (R) SQL Server Execute Package Utility Version 12.0.2000.8 for 64-bit Copyright (C) Microsoft Corporation. All rights reserved. Option "/" is not valid.
我該如何解決這個問題?謝謝大家。
您的第二個和第三個'/' – TheValyreanGroup