System.Data.Common Namespace DataColumnMappingCollection Class
Adds a column mapping to the collection with the given SourceColumn name and DataSetColumn name.
[ VB ]
Overloads Public Function Add ( _
ByVal sourceColumn As String, _
ByVal dataSetColumn As String _
) As DataColumnMapping
[ C# ]
public DataColumnMapping Add (
string sourceColumn,
string dataSetColumn
);
[ C++ ]
public: DataColumnMapping* Add (
String* sourceColumn,
String* dataSetColumn
);
[ JScript ]
public function Add (
sourceColumn : String,
dataSetColumn : String
) : DataColumnMapping;
- sourceColumn
- The case-sensitive name of a SourceColumn to map from.
- dataSetColumn
- The case-insensitive name of a DataSetColumn to map to.
The DataColumnMapping object that was added to the collection.
The following example initializes a DataColumnMappingCollection, adds DataColumnMapping objects to the collection, and displays a list of the mapped source columns.
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 DataColumnMappingCollection.Add Overload List