asp.net.ph

DataColumnMapping GetDataColumnBySchemaAction Method

System.Data.Common Namespace   DataColumnMapping Class


Returns a DataColumn from the given DataTable using the MissingSchemaAction and the type of the DataColumn.

[ VB ]
Public Function GetDataColumnBySchemaAction ( _
   ByVal dataTable As DataTable, _
   ByVal dataType As Type, _
   ByVal schemaAction As MissingSchemaAction _
) As DataColumn

[ C# ]
public DataColumn GetDataColumnBySchemaAction (
   DataTable dataTable,
   Type dataType,
   MissingSchemaAction schemaAction
);

[ C++ ]
public: DataColumn* GetDataColumnBySchemaAction (
   DataTable* dataTable,
   Type* dataType,
   MissingSchemaAction schemaAction
);

[ JScript ]
public function GetDataColumnBySchemaAction (
   dataTable : DataTable,
   dataType : Type,
   schemaAction : MissingSchemaAction
) : DataColumn;

Parameters

dataTable
The DataTable to get the column from.
dataType
The Type of the data column.
schemaAction
One of the MissingSchemaAction values.

Return Value

A DataColumn.

Remarks

If no column of the given dataType exists in the specified dataTable, a null reference is returned, and the following happens for the given MissingSchemaAction:

MissingSchemaAction Action Taken
Error An exception is thrown.
Ignore Returns a null.
Add A DataColumn of type dataType is created, but is not added to the dataTable.

Example

The following example gets the DataColumn that is of type Single for a given DataTable. If no column of type Single exists in the DataTable, a null reference is returned.

void CreateDataColumn ( DataTable myTable, DataColumnMapping myMap ) {
   DataColumn currentCol = myMap.GetDataColumnBySchemaAction (
      myTable, typeof ( Single ), MissingSchemaAction.Ignore );
}
  C# VB

See Also

DataColumnMapping Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph