System.Data.Common Namespace
Represents a collection of column mappings for a DataTableMapping object.
Visibility |
Name |
Parameters |
Return Type |
public |
Add |
(
String
sourceColumn
,
String
dataSetColumn
)
|
DataColumnMapping
|
public |
Add |
(
Object
value
)
|
Int32
|
public |
AddRange |
(
Array
values
)
|
Void
|
public |
AddRange |
(
DataColumnMapping
values
)
|
Void
|
public |
Clear |
( )
|
Void
|
public |
Contains |
(
Object
value
)
|
Boolean
|
public |
Contains |
(
String
value
)
|
Boolean
|
public |
CopyTo |
(
DataColumnMapping
array
,
Int32
index
)
|
Void
|
public |
CopyTo |
(
Array
array
,
Int32
index
)
|
Void
|
public |
GetByDataSetColumn |
(
String
value
)
|
DataColumnMapping
|
public static |
GetColumnMappingBySchemaAction |
(
DataColumnMappingCollection
columnMappings
,
String
sourceColumn
,
MissingMappingAction
mappingAction
)
|
DataColumnMapping
|
public static |
GetDataColumn |
(
DataColumnMappingCollection
columnMappings
,
String
sourceColumn
,
Type
dataType
,
DataTable
dataTable
,
MissingMappingAction
mappingAction
,
MissingSchemaAction
schemaAction
)
|
DataColumn
|
public |
GetEnumerator |
( )
|
IEnumerator
|
public |
IndexOf |
(
Object
value
)
|
Int32
|
public |
IndexOf |
(
String
sourceColumn
)
|
Int32
|
public |
IndexOfDataSetColumn |
(
String
dataSetColumn
)
|
Int32
|
public |
Insert |
(
Int32
index
,
Object
value
)
|
Void
|
public |
Insert |
(
Int32
index
,
DataColumnMapping
value
)
|
Void
|
public |
Remove |
(
DataColumnMapping
value
)
|
Void
|
public |
Remove |
(
Object
value
)
|
Void
|
public |
RemoveAt |
(
Int32
index
)
|
Void
|
public |
RemoveAt |
(
String
sourceColumn
)
|
Void
|
|
The DataColumnMappingCollection contains the collection of DataColumnMapping objects that link the table columns in a DataSet to those in a data source. This collection is accessed via the DataTableMapping.ColumnMappings property.
Like most data collections in ADO.NET, the DataColumnMappingCollection uses standard collection methods to manage the items in the collection. These include the methods Add, Clear, and Remove.
The collection also includes a Count property to determine how many DataColumn objects are in the collection, and a Contains method to verify whether a specified column mapping exists in the collection.
The following example demonstrates using the ColumnMappings property to print the values of each DataColumnMapping object in the collection.
void getColumnMappings ( DataTableMapping myTableMap ) {
// get column mappings
DataColumnMappingCollection myFieldsMaps = myTableMap.ColumnMappings;
string myMessage = "Column Mappings:\n";
for ( int i=0; i < myFieldsMaps.Count; i++ ) {
myMessage += i.ToString ( ) + " " + myFieldsMaps [ ].ToString ( ) + "\n";
}
Response.Write ( myMessage );
}
Public Sub getColumnMappings ( ByVal myTableMap As DataTableMapping )
' get column mappings
Dim myFieldsMaps As DataColumnMappingCollection = myTableMap.ColumnMappings
Dim myMessage As String = "Column Mappings:" + ControlChars.Cr
Dim i As Integer
For i = 0 To myFieldsMaps.Count - 1
myMessage += i.ToString ( ) + " " + myFieldsMaps ( i ).ToString ( ) + ControlChars.Cr
Next i
Response.Write ( myMessage )
End Sub |
|
C# |
VB |
ColumnMappings DataColumnMapping