System.Data.Common Namespace DataTableMappingCollection Class
Sets or retrieves the DataTableMapping from the collection at the specified index.
DataTableMapping variable = DataTableMappingCollection.Item [ index ];
... or ...
DataTableMapping variable = DataTableMappingCollection [ index ];
dim variable as DataTableMapping = DataTableMappingCollection.Item ( index )
... or ...
dim variable as DataTableMapping = DataTableMappingCollection ( index )
variable : DataTableMapping = DataTableMappingCollection.Item ( index );
... or ...
variable : DataTableMapping = DataTableMappingCollection ( index ); |
|
C# |
VB |
JScript |
- index
- The index of the DataTableMapping to return.
The DataTableMapping at the specified index.
Exception Type |
Condition |
IndexOutOfRangeException |
Occurs when the index value is greater than the number of items in the collection. |
Use the Contains method to test for the existence of a specific DataTableMapping.
The following example demonstrates using the Item property to print the values of each DataTableMapping object in the collection.
void getTableMappings ( DataAdapter myAdapter ) {
// get table mappings
DataTableMappingCollection myTables = myAdapter.TableMappings;
string myMessage = "Table Mappings:\n";
for ( int i=0; i < myTables.Count; i++ ) {
myMessage += i.ToString ( ) + " " + myTables [ ].ToString ( ) + "\n";
}
Response.Write ( myMessage );
}
Public Sub getTableMappings ( ByVal myAdapter As DataAdapter )
' get table mappings
Dim myTables As DataTableMappingCollection = myAdapter.TableMappings
Dim myMessage As String = "Table Mappings:" + ControlChars.Cr
Dim i As Integer
For i = 0 To myTables.Count - 1
myMessage += i.ToString ( ) + " " + myTables ( i ).ToString ( ) + ControlChars.Cr
Next i
Response.Write ( myMessage )
End Sub |
|
C# |
VB |
DataTableMappingCollection Members DataTableMappingCollection.Item Overload List