System.Data.Common Namespace DataColumnMappingCollection Class
Returns the index of a DataColumnMapping with the specified DataSetColumn name.
[ VB ]
NotOverridable Overloads Public Function IndexOf ( _
ByVal dataSetColumn As String _
) As Integer
[ C# ]
public int IndexOf (
String dataSetColumn
);
[ C++ ]
public: __sealed int IndexOf (
String* dataSetColumn
);
[ JScript ]
public function IndexOf (
dataSetColumn : String
) : int
- dataSetColumn
- The case-insensitive name of a DataSetColumn.
The index of the DataColumnMapping if it is in the collection; otherwise, -1.
The following example searches for a DataColumnMapping object with the given DataSetColumn name. If the DataColumnMapping exists, it is returned.
public void FindDataColumnMapping ( DataTableMapping myTable ) {
// get column mappings
DataColumnMappingCollection myColumns = myTable.ColumnMappings;
DataColumnMapping mycolumn;
if ( myColumns.IndexOfDataSetColumn ( "acct_ID" ) != -1 ) {
mycolumn = myColumns.GetByDataSetColumn ( "acct_ID" );
}
}
Public Sub FindDataColumnMapping ( ByVal myTable As DataTableMapping )
' get column mappings
Dim myColumns As DataColumnMappingCollection = myTable.ColumnMappings;
Dim mycolumn As DataColumnMapping;
If ( myColumns.IndexOfDataSetColumn ( "acct_ID" ) <> -1 ) {
mycolumn = myColumns.GetByDataSetColumn ( "acct_ID" );
End If
End Sub |
|
C# |
VB |
DataColumnMappingCollection Members IndexOf Contains