asp.net.ph

DataTableMapping.ColumnMappings Property

System.Data.Common Namespace   DataTableMapping Class


Returns the collection of column mappings for a table.

Syntax


Script [ DataColumnMappingCollection variable = ] DataTableMapping.ColumnMappings

Return Value

A DataColumnMappingCollection that provides the mappings between fields in a data source and DataColumn objects in a DataSet.

The property is read only with no default value.

Remarks

The ColumnMappings property is used to retrieve the collection of DataColumnMapping objects, each of which represents the mapping between a field in a table in the data source and a linked DataColumn in a DataTable within a DataSet.

The column mappings for a data table are not exposed directly, but are accessed via a DataTableMapping object, which in turn is exposed via the TableMappings property of a given DataAdapter.

Example

The following example demonstrates using the ColumnMappings property to print the values of each DataColumnMapping object in the collection.

void getColumnMappings ( DataTableMapping myTableMap ) {
   // get column mappings
   DataColumnMappingCollection myFieldsMaps = myTableMap.ColumnMappings;
   string myMessage = "Column Mappings:\n";

   for ( int i=0; i < myFieldsMaps.Count; i++ ) {
      myMessage += i.ToString ( ) + " " + myFieldsMaps [ ].ToString ( ) + "\n";
   }
   Response.Write ( myMessage );
}
  C# VB

See Also

DataTableMapping Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph