/// <summary> /// Does the BCP command. /// </summary> /// <param name="cmd">The CMD.</param> /// <param name="sourceTable">The source table.</param> /// <returns>The log text.</returns> private string DoBcpCommand(CmdHelper cmd, string sourceTable) { string outDataFileFullName = ""; string log = ""; cmd.ClearOutput(); cmd.ExecuteCommand("bcp.exe " + GetCommand(sourceTable, out outDataFileFullName)); if (cmd.StdOutput.Length > 0) { log = "Command Output:\r\n{0}\r\n".FormatWith(cmd.StdOutput.ToString()); } if (cmd.StdErr.Length > 0) { log += "Command Output:\r\n{0}\r\n".FormatWith(cmd.StdErr.ToString()); } if (cmd.LastExitCode == 0) { this.SuccessTableCount++; AsyncCompress(outDataFileFullName); } return(log); }
/// <summary> /// Does the BCP command ex. /// </summary> /// <param name="cmd">The CMD.</param> /// <param name="serialNo">The serial no.</param> /// <param name="startRow">The start row.</param> /// <param name="endRow">The end row.</param> /// <param name="tableName">Name of the table.</param> /// <returns>The command text.</returns> private string DoBcpCommandEx(CmdHelper cmd, int serialNo, int startRow, int endRow, string tableName) { string outDataFileFullName = ""; string log = ""; cmd.ClearOutput(); cmd.ExecuteCommand("bcp.exe " + GetCommandEx(serialNo, startRow, endRow, tableName, out outDataFileFullName)); if (cmd.StdOutput.Length > 0) { log = "Command Output:\r\n{0}\r\n".FormatWith(cmd.StdOutput.ToString()); } if (cmd.StdErr.Length > 0) { log += "Command Output:\r\n{0}\r\n".FormatWith(cmd.StdErr.ToString()); } if (cmd.LastExitCode == 0) { AsyncCompress(outDataFileFullName); } return(log); }