/// <summary> /// Copies the rows from the source into the the target table. /// </summary> /// <param name="source">The source.</param> /// <param name="target">The target.</param> /// <param name="filter">The filter.</param> /// <param name="visibleFields">Specifies which fields from the input table to rename and make visible in the output table /// view.</param> /// <param name="trackCancel">The track cancel.</param> /// <param name="eventHandler">The event handler.</param> public static void CopyTo(this ITable source, ITable target, IQueryFilter filter, Dictionary <string, string> visibleFields, ITrackCancel trackCancel, IGeoProcessorEvents eventHandler) { object input = source; if (filter != null && !string.IsNullOrEmpty(filter.WhereClause)) { var name = string.Format("{0}_V", ((IDataset)source).Name); input = source.MakeView(name, filter, visibleFields, trackCancel, eventHandler); } CopyRows gp = new CopyRows(); gp.in_rows = input; gp.out_table = target; gp.Run(trackCancel, eventHandler); }
/// <summary> /// Writes the rows from an input table to a new table. /// </summary> /// <param name="source">The rows from a table to be copied.</param> /// <param name="filter">The filter used to create a subset of the data.</param> /// <param name="tableName">The name of the table to which the rows will be written.</param> /// <param name="workspace">The workspace that will contain the table.</param> /// <param name="trackCancel">The track cancel.</param> /// <param name="eventHandler">The event handler.</param> /// <returns> /// Returns a <see cref="ITable" /> representing the exported table. /// </returns> public static ITable Export(this ITable source, IQueryFilter filter, string tableName, IWorkspace workspace, ITrackCancel trackCancel, IGeoProcessorEvents eventHandler) { object input = source; if (filter != null && !string.IsNullOrEmpty(filter.WhereClause)) { var name = string.Format("V_{0}", tableName); input = source.MakeView(name, filter, null, trackCancel, eventHandler); } CopyRows gp = new CopyRows(); gp.in_rows = input; gp.out_table = tableName; if (gp.Run(trackCancel, eventHandler) == esriJobStatus.esriJobSucceeded) { var table = workspace.GetTable(tableName); return(table); } return(null); }