asp.net.ph

IDataAdapter.TableMappings Property

System.Data Namespace   IDataAdapter Class


Returns a collection of table mapping objects, each representing how a source table is mapped to a data set table.

Syntax


Script [ ITableMappingCollection variable = ] IDataAdapter.TableMappings

Return Value

An ITableMappingCollection that provides the master mapping between the tables in a data source and the DataTable objects in a DataSet.

This property is read-only with no default value.

Classes that Implement ITableMappingCollection


Class Description
DataTableMappingCollection Represents a collection of DataTableMapping objects.

Remarks

The ITableMappingCollection interface allows an inheriting class to implement a table mapping collection. When reconciling changes, the IDataAdapter uses the ITableMappingCollection to associate the column names used by the data source with the column names used by the DataSet.

An application does not create an instance of the ITableMappingCollection interface directly, but creates an instance of a class that inherits ITableMappingCollection.

Classes that inherit ITableMappingCollection must implement the inherited members, and typically define additional members to add provider-specific functionality. For example, the ITableMappingCollection interface defines one implementation of the RemoveAt method. In turn, the DataTableMappingCollection class inherits this method, and defines two additional overloads of RemoveAt.

Notes to Implementers: When you inherit from the ITableMappingCollection interface, you should implement the following constructor:

Item Description
PrvTableMappingCollection ( ) Creates an empty PrvTableMappingCollection class.

For more information, see Setting Up DataTable and DataColumn Mappings.

Example

The following example uses a derived class, OleDbDataAdapter, to add DataTableMapping objects to its TableMappings collection and display a list of those mapped source tables. This example assumes that an OleDbDataAdapter has already been created.

void ShowTableMappings ( ) {
   // ... code to construct dataadapter here ...

   myAdapter.TableMappings.Add ( "Categories","DataCategories" );
   myAdapter.TableMappings.Add ( "Orders","DataOrders" );
   myAdapter.TableMappings.Add ( "Products","DataProducts" );
   string myMessage = "Table Mappings:\n";

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

See Also

IDataAdapter 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