Error
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.

tablewithonlyselectedcolumns

C# - Get selected columns from DataTable
Tuesday, 25 October 2011 21:52


public DataTable GetSelectedColumns(DataTable _dataTable)
{
string[] selectedColumns = new[] { "First_Name", "Salary" };

DataTable tableWithOnlySelectedColumns =
new DataView(_dataTable).ToTable(false, selectedColumns);

return tableWithOnlySelectedColumns;
}

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/m4684X_MZJg/13813

 


Taxonomy by Zaragoza Online