System.Data.Common Namespace DataColumnMappingCollection Class
Adds a column mapping to the collection.
1. Adds a column mapping object to the collection.
2. Adds a column mapping to the collection with the given SourceColumn name and DataSetColumn name.
The following example initializes a DataColumnMappingCollection, adds DataColumnMapping objects to the collection, and displays a list of the mapped source columns.
NOTE: This example uses one of the overloaded versions of Add. For other examples that may be available, see the individual overload topics.
void CreateColumnMappings ( ) {
DataColumnMappingCollection myFieldsMaps = new DataColumnMappingCollection ( );
myFieldsMaps.Add ( "Category Name", "DataCategory" );
myFieldsMaps.Add ( "Description", "DataDescription" );
myFieldsMaps.Add ( "Picture", "DataPicture" );
string myMessage = "Column Mappings:\n";
for ( int i=0; i < myFieldsMaps.Count; i++ ) {
myMessage += i.ToString ( ) + " " + myFieldsMaps [ ].ToString ( ) + "\n";
}
Response.Write ( myMessage );
}
Public Sub CreateColumnMappings ( )
Dim myFieldsMaps As New DataColumnMappingCollection ( )
myFieldsMaps.Add ( "Category Name", "DataCategory" )
myFieldsMaps.Add ( "Description", "DataDescription" )
myFieldsMaps.Add ( "Picture", "DataPicture" )
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 |
DataColumnMappingCollection Members AddRange Remove RemoveAt Clear