asp.net.ph

DataRowCollection.Add Method

System.Data Namespace   DataRowCollection Class


Adds a row to the DataTable.Rows collection.

Overload List

1. Adds the specified DataRow object to the collection.

2. Initializes a row using specified values and adds it to the collection.


Example

The following example uses the Add method to create and add a new DataRow object to a DataRowCollection.

NOTE: This example uses one of the overloaded versions of Add. For other examples that may be available, see the individual overload topics.

private void AddRow ( DataTable myTable ) {
   DataRowCollection myRows;
   DataRow myNewRow;
   // create an array with three elements.
   object [ ] rowVals = new object [ 3 ];
   myRows = myTable.Rows;
   rowVals [ 0 ] = "hello";
   rowVals [ 1 ] = "world";
   rowVals [ 2 ] = "two";
   // add and return the new row.
   myNewRow = myRows.Add ( rowVals );
}
  C# VB

See Also

DataRowCollection 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