我使用SSMAforAccessConsole32.exe
将Access DB迁移到SQL DB。因为我需要拨打exe
。我使用Process exeProcess = Process.Start(objPSI)
来启动这个过程。当SSMAforAccessConsole32.exe
抛出一些异常时,它不会返回异常。
需要帮助才能获得exe
引发的异常。任何帮助将不胜感激。
请在下面找到代码。
ProcessStartInfo objPSI = new ProcessStartInfo();
objPSI.Arguments = "-s " + '"' + strDir + "AssessmentReportGenerationSample.xml" + '"' + " -c " + '"' + strDir + "ServersConnectionFileSample.xml" + '"' + " -v " + '"' + strDir + strVariableFile + '"';
//objPSI.Arguments = "-s " + '"' + strDir + "AssessmentReportGenerationSample.xml" + '"' + " -c " + '"' + strDir + "ServersConnectionFileSample.xml" + '"' + " -v " + '"' + strDir + "VariableValueFileSample.xml" + '"';
objPSI.FileName = strDIR1 + "SSMAforAccessConsole32.exe";
objPSI.CreateNoWindow = true;
objPSI.UseShellExecute = false;
objPSI.RedirectStandardError = true;
try
{
using (Process exeProcess = Process.Start(objPSI))
{
string error = exeProcess.StandardError.ReadToEnd();
// string strError = SSMAError.ExceptionResult.Propagate.ToString();
//exeProcess.
exeProcess.WaitForExit();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
// Log error.
}