This topic has not yet been rated - Rate this topic

DataTableMappingCollection.Add Method (String, String)

Adds a DataTableMapping object to the collection when given a source table name and a DataSet table name.

Namespace: System.Data.Common
Assembly: System.Data (in system.data.dll)

public DataTableMapping Add (
	string sourceTable,
	string dataSetTable
)
public DataTableMapping Add (
	String sourceTable, 
	String dataSetTable
)
public function Add (
	sourceTable : String, 
	dataSetTable : String
) : DataTableMapping
Not applicable.

Parameters

sourceTable

The case-sensitive name of the source table to map from.

dataSetTable

The name, which is not case-sensitive, of the DataSet table to map to.

Return Value

The DataTableMapping object that was added to the collection.

The following example creates a DataTableMappingCollection, adds DataTableMapping objects to the collection, and displays a list of the mapped source tables.

public void CreateTableMappings() 
{
    DataTableMappingCollection mappings = 
        new DataTableMappingCollection();
    mappings.Add("Categories","DataCategories");
    mappings.Add("Orders","DataOrders");
    mappings.Add("Products","DataProducts");
    string message = "TableMappings:\n";
    for(int i=0;i < mappings.Count;i++)
    {
        message += i.ToString() + " " 
            + mappings[i].ToString() + "\n";
    }
    Console.WriteLine(message);
}

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

XNA Framework

Supported in: 1.0
Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.