System.Data.Common Namespace DataAdapter Class
Returns a collection of DataTableMapping objects that represent the mapping between a table in the data source and a DataTable in the DataSet.
Script |
[ DataTableMappingCollection variable = ] DataAdapter.TableMappings |
A DataTableMappingCollection object that provides the master mapping between tables in a data source and DataTable objects in a DataSet.
This property is read-only with no default value.
The TableMappings property is used to retrieve the collection of DataTableMapping objects, each of which represents the mapping between a table in the data source and a linked DataTable within a DataSet.
When reconciling changes, the DataAdapter uses the DataTableMappingCollection to associate the column names used by the data source with the column names used by the DataSet.
The following example demonstrates using the TableMappings property to print the values of each DataTableMapping object in the collection.
void getTableMappings ( DataAdapter myAdapter ) {
// get table mappings
DataTableMappingCollection myTables = myAdapter.TableMappings;
string myMessage = "Table Mappings:\n";
for ( int i=0; i < myTables.Count; i++ ) {
myMessage += i.ToString ( ) + " " + myTables [ ].ToString ( ) + "\n";
}
Response.Write ( myMessage );
}
Public Sub getTableMappings ( ByVal myAdapter As DataAdapter )
' get table mappings
Dim myTables As DataTableMappingCollection = myAdapter.TableMappings
Dim myMessage As String = "Table Mappings:" + ControlChars.Cr
Dim i As Integer
For i = 0 To myTables.Count - 1
myMessage += i.ToString ( ) + " " + myTables ( i ).ToString ( ) + ControlChars.Cr
Next i
Response.Write ( myMessage )
End Sub |
|
C# |
VB |
DataAdapter Members