Export (0) Print
Expand All

DataColumn.ColumnMapping Property

Gets or sets the MappingType of the column.

Namespace:  System.Data
Assembly:  System.Data (in System.Data.dll)

public function get ColumnMapping () : MappingType 
public function set ColumnMapping (value : MappingType)

Property Value

Type: System.Data.MappingType
One of the MappingType values.

The ColumnMapping property determines how a DataColumn is mapped when a DataSet is saved as an XML document using the WriteXml method.

For example, if a DataColumn is named "customerID," and its ColumnMapping property is set to MappingType.Element, the column value will produce the following XML:

 <Customers>
  <customerID>ALFKI</customerID>
 ......
  </Customers>
  <Orders>
  <OrderID>12345</OrderID>
  <customerID>ALFKI</customerID>
 ......
  </Orders>

However, if the same column is mapped to MappingType.Attribute, the following XML is produced:

 <Customers customerID="ALFKI"........more attributes.....>
  <Order orderID="1234"....more attributes..../>
  <Order orderID="1234"....more attributes..../>
 ...... More orders for this customer
  </Customers>

Use the DataColumn constructor that contains the type argument to specificy how the DataColumn is mapped when its DataSet is transformed to an XML document.

The ColumnMapping property corresponds to the constructor argument type.

The following example sets the ColumnMapping type property of new DataColumn.

No code example is currently available or this language may not be supported.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC, Xbox 360, Zune

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 3.5, 2.0, 1.0

XNA Framework

Supported in: 3.0, 2.0, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft