asp.net.ph

DataTableMapping Class

System.Data.Common Namespace


Represents the mapping between a table in a data source and its linked DataTable in a DataSet.

DataTableMapping Class Members

Collapse   Constructors

Visibility Constructor Parameters
public DataTableMapping ( )
public DataTableMapping ( String sourceTable , String dataSetTable )
public DataTableMapping ( String sourceTable , String dataSetTable , DataColumnMapping columnMappings )

Collapse   Properties

Visibility Name Value Type Accessibility
public ColumnMappings DataColumnMappingCollection [ Get ]
public DataSetTable String [ Get , Set ]
public SourceTable String [ Get , Set ]

Collapse   Methods

Visibility Name Parameters Return Type
public GetColumnMappingBySchemaAction ( String sourceColumn , MissingMappingAction mappingAction ) DataColumnMapping
public GetDataColumn ( String sourceColumn , Type dataType , DataTable dataTable , MissingMappingAction mappingAction , MissingSchemaAction schemaAction ) DataColumn
public GetDataTableBySchemaAction ( DataSet dataSet , MissingSchemaAction schemaAction ) DataTable
public ToString ( ) String

Remarks

A DataTableMapping provides a master mapping between a table in the data source, and a DataTable that contains the results of the query issued against the data source. This class is used by a DataAdapter when populating a DataSet.

A DataTableMapping enables you to use table names in a DataSet that are different from those in the data source. The DataAdapter uses the mapping to match the tables when reconciling changes made to either the data source or the DataSet.

The DataTableMapping name can be passed in place of the DataTable name when using the Fill method of a DataAdapter. For more information, see Setting Up DataTable and DataColumn Mappings.

Example

The following example shows how to add DataTableMapping objects to the TableMappings collection of an SqlDataAdapter, and display a list of those mapped source tables.

void ShowTableMappings ( SqlDataAdapter myAdapter ) {
   DataTableMappingCollection myTables = myAdapter.TableMappings;
   myTables.Add ( "Categories", "DataCategories" );
   myTables.Add ( "Orders", "DataOrders" );
   myTables.Add ( "Products", "DataProducts" );
   string myMessage = "Table Mappings:\n";

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

See Also

DataTableMappingCollection   DataColumnMapping   DataColumnMappingCollection 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