C# sqlcmd的退出代码-100是什么意思
我有一个C#控制台应用程序,它调用sqlcmd utilty,并将退出代码设置为-100 代码如下所示C# sqlcmd的退出代码-100是什么意思,c#,sql,.net,visual-studio-2012,sqlcmd,C#,Sql,.net,Visual Studio 2012,Sqlcmd,我有一个C#控制台应用程序,它调用sqlcmd utilty,并将退出代码设置为-100 代码如下所示 private int RunSP() { int exitCode = 1; Log.Log("Creating Stored Procedure: " + Config.ExternalSPname); Process p = new Process(); // Redirect the output st
private int RunSP()
{
int exitCode = 1;
Log.Log("Creating Stored Procedure: " + Config.ExternalSPname);
Process p = new Process();
// Redirect the output stream of the child process.
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = string.Format("sqlcmd -S {0} -d {1} -Q \"EXIT(exec {2} @ MainListID=N'{3}', @ TempListID =N'{4}')\"", Config.ExternalSPserver, Config.ExternalSPdb, Config.ExternalSPname, Config.ExternalSPmainlist, Config.ExternalSPtemplist);
Log.Log("SP command: " + p.StartInfo.FileName);
p.Start();
p.WaitForExit();
exitCode = p.ExitCode;
p.Close();
return exitCode;
}
存储过程在工作时写为返回退出代码1,在失败时写为0
我想知道sqlmod在某些情况下是否可以返回-100
谢谢您是否检查了文件名是否获得了正确的值/您可能需要将
-b
和/或-V
选项添加到sqlcmd
以获得有意义的错误代码结果。请参阅@Narendra文件名ok@MichaelBurr我正在用你的推荐进行测试。现在,这个问题似乎只是在@和MainListID之间的空白,另一个空白在@和TopPLISTID之间。谢谢MichaelBurr,来自SqLCMD的100的链接在你评论的链接上。