我有一个储存在2008年航天中心服务器项目中的程序。 这项职能称为含有一定微米的ole光应用。
[Microsoft.SqlServer.Server.SqlProcedure()]
public static SqlInt32 ExecuteApp(SqlString utilPath, SqlString arguments, ref SqlString result)
{
ProcessStartInfo info = new ProcessStartInfo("cmd.exe");
Process p = new Process();
try
{
//ProcessStartInfo to run the DOS command attrib
info.RedirectStandardOutput = true;
info.RedirectStandardError = true;
info.UseShellExecute = false;
info.CreateNoWindow = true;
info.Arguments = string.Format(@"/c ""{0}"" {1}", utilPath, arguments);
SqlContext.Pipe.Send(info.Arguments);
p.StartInfo = info;
p.Start();
String processResults = p.StandardOutput.ReadToEnd();
SqlContext.Pipe.Send(processResults);
result = processResults;
if (String.IsNullOrEmpty((String)result))
result = p.StandardError.ReadToEnd();
return 1;
}
finally
{
p.Close();
}
}
The problem here with param that contain xml. This is a expression for execute stored procedure:
declare @Result nvarchar(max)
exec ExecuteApp C:Console.exe , send "<messages><message>my message</message></messages>" , @Result out
select @Result
执行所储存的程序 我有了一个错误:
并且,目前是意外的。
我要指出,没有x毫升,所有人都是正常工作。