CSharp examples for System.Data:DataTable
Copies extended properties of data table columns.
/******************************************************************** * FulcrumWeb RAD Framework - Fulcrum of your business * * Copyright (c) 2002-2010 FulcrumWeb, ALL RIGHTS RESERVED * * * * THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED * * FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE * * COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE * * AVAILABLE TO OTHER INDIVIDUALS WITHOUT EXPRESS WRITTEN CONSENT * * AND PERMISSION FROM FULCRUMWEB. CONSULT THE END USER LICENSE * * AGREEMENT FOR INFORMATION ON ADDITIONAL RESTRICTIONS. * ********************************************************************/ using System.Collections; using System.Text; using System.Data; using System.Collections.Generic; using System;/*from w ww. j a v a 2 s . c om*/ public class Main{ //-------------------------------------------------------------------------- /// <summary> /// Copies extended properties of data table columns. /// </summary> /// <param name="source">source table</param> /// <param name="target">target table</param> static public void CopyExtendedProperties(DataTable source, DataTable target) { foreach (DataColumn targetColumn in target.Columns) { int sourceColumnIndex = source.Columns.IndexOf(targetColumn.ColumnName); if (sourceColumnIndex >= 0) { DataColumn sourceColumn = source.Columns[sourceColumnIndex]; targetColumn.Caption = sourceColumn.Caption; foreach (object key in sourceColumn.ExtendedProperties.Keys) { targetColumn.ExtendedProperties[key] = sourceColumn.ExtendedProperties[key]; } } } } }