InsertAt Method

DataRowCollection.InsertAt Method

Inserts a new row into the collection at the specified location.

[Visual Basic]
Public Sub InsertAt( _
   ByVal row As DataRow, _
   ByVal pos As Integer _
public void InsertAt(
 DataRow row,
 int pos
public: void InsertAt(
 DataRow* row,
 int pos
public function InsertAt(
   row : DataRow,
 pos : int


The DataRow to add.
The location in the collection where you want to add the DataRow.


The location specified by InsertAt is reflected by the order of rows in the DataRowCollection only. If more than one row is returned in a DataRow array, the inserted row may not be returned in the location specified by InsertAt. For example, the Rows property returns the row in the specified insert position. Select and GetChildRows may not. When you write the contents of the DataRowCollection as XML (for example, WriteXml), the rows are written according to the order specified by the DataRowCollection.

If the value specified for the pos parameter is greater than the number of rows in the collection, the new row is added to the end.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

DataRowCollection Class | DataRowCollection Members | System.Data Namespace

© 2015 Microsoft