Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

DataAdapter.TableMappings Property

Definition

Namespace:
System.Data.Common
Assemblies:
netstandard.dll, System.Data.Common.dll
Assembly:
System.Data.Common.dll
Assembly:
System.Data.dll
Assembly:
netstandard.dll
Source:
DataAdapter.cs
Source:
DataAdapter.cs
Source:
DataAdapter.cs
Source:
DataAdapter.cs
Source:
DataAdapter.cs

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Gets a collection that provides the primary mapping between a source table and a DataTable.

public:
 property System::Data::Common::DataTableMappingCollection ^ TableMappings { System::Data::Common::DataTableMappingCollection ^ get(); };
public System.Data.Common.DataTableMappingCollection TableMappings { get; }
[System.Data.DataSysDescription("DataAdapter_TableMappings")]
public System.Data.Common.DataTableMappingCollection TableMappings { get; }
member this.TableMappings : System.Data.Common.DataTableMappingCollection
[<System.Data.DataSysDescription("DataAdapter_TableMappings")>]
member this.TableMappings : System.Data.Common.DataTableMappingCollection
Public ReadOnly Property TableMappings As DataTableMappingCollection

Property Value

A collection that provides the primary mapping between the returned records and the DataSet. The default value is an empty collection.

Attributes

Examples

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.

public void ShowTableMappings() {
 // ...
 // create myDataAdapter
 // ...
 myDataAdapter.TableMappings.Add("Categories","DataCategories");
 myDataAdapter.TableMappings.Add("Orders","DataOrders");
 myDataAdapter.TableMappings.Add("Products","DataProducts");
 string myMessage = "Table Mappings:\n";
 for(int i=0;i < myDataAdapter.TableMappings.Count;i++) {
 myMessage += i.ToString() + " "
 + myDataAdapter.TableMappings[i].ToString() + "\n";
 }
 MessageBox.Show(myMessage);
}
Public Sub ShowTableMappings()
 ' ...
 ' create myDataAdapter
 ' ...
 myDataAdapter.TableMappings.Add("Categories", "DataCategories")
 myDataAdapter.TableMappings.Add("Orders", "DataOrders")
 myDataAdapter.TableMappings.Add("Products", "DataProducts")
 Dim myMessage As String = "Table Mappings:" + ControlChars.Cr
 Dim i As Integer
 For i = 0 To myDataAdapter.TableMappings.Count - 1
 myMessage += i.ToString() + " " _
 + myDataAdapter.TableMappings(i).ToString() + ControlChars.Cr
 Next i
 MessageBox.Show(myMessage)
End Sub

Remarks

When reconciling changes, the DataAdapter uses the DataTableMappingCollection collection to associate the column names used by the data source with the column names used by the DataSet.

Applies to

See also


Feedback

Was this page helpful?