I have created console application to execute DB2 commands using C#. my commands executed fine and DB2 CLP command window opened i can see output as well. but once my command executed I am not able to close DB2 CLP window using C# code.
I tried to kill Process.GetProcessByName but not succeeded.
I also used Application.Exit() method.
Note: i am connecting to server DB2 using local machine.
Below is my code.
objProcStartInfo = new ProcessStartInfo("db2cmd.exe", "db2 connect to " + strMasterdatabaseName + " user " + strserviceAccountUserName + " using " + strserviceAccountPassword + "&db2 -f " + strexportFilePath + " > " + strexportLogFilePath + "");
objProcStartInfo.RedirectStandardOutput = false;
objProcStartInfo.UseShellExecute = false;
objProcStartInfo.CreateNoWindow = false;
objProcess = new Process();
objProcess.StartInfo = objProcStartInfo;
catch (Exception ex)
can someone please provide any direction on this?
modified 30-Mar-16 12:49pm.