Редактиране

Споделяне чрез


DataColumnMappingCollection.IndexOfDataSetColumn(String) Method

Definition

Gets the location of the specified DataColumnMapping with the given DataSet column name.

public:
 int IndexOfDataSetColumn(System::String ^ dataSetColumn);
public int IndexOfDataSetColumn (string? dataSetColumn);
public int IndexOfDataSetColumn (string dataSetColumn);
member this.IndexOfDataSetColumn : string -> int
Public Function IndexOfDataSetColumn (dataSetColumn As String) As Integer

Parameters

dataSetColumn
String

The name, which is not case-sensitive, of the data set column to find.

Returns

The zero-based location of the specified DataColumnMapping with the given DataSet column name, or -1 if the DataColumnMapping object does not exist in the collection.

Examples

The following example searches for a DataColumnMapping within the collection. If the object exists, it is returned. The example assumes that a DataColumnMappingCollection collection and a DataColumnMapping object have been created.

public void FindDataColumnMapping()
{
    // ...
    // create mappings and mapping
    // ...
    if (mappings.IndexOfDataSetColumn("datadescription") != -1)
        mapping = mappings.GetByDataSetColumn("datadescription");
}
Public Sub FindDataColumnMapping()
    ' ...
    ' create mappings and mapping
    ' ...
    If mappings.IndexOfDataSetColumn("datadescription") <> - 1 Then
        mapping = mappings.GetByDataSetColumn("datadescription")
    End If
End Sub

Applies to

See also