语言

DataRowCollection.InsertAt(DataRow, Int32) 方法

定义

将新行插入集合中的指定位置。

public:
 void InsertAt(System::Data::DataRow ^ row, int pos);
public void InsertAt(System.Data.DataRow row, int pos);
member this.InsertAt : System.Data.DataRow * int -> unit
Public Sub InsertAt (row As DataRow, pos As Integer)

参数

row
DataRow

要 DataRow 添加的。

pos
Int32

要在其中添加 DataRow 的集合中的 (从零开始)位置。

例外

小于 pos 0。

注解

指定的 InsertAt 位置由唯一行 DataRowCollection 的顺序反映。 如果在数组中 DataRow 返回了多行,则插入的行可能不会在指定的 InsertAt位置返回。 例如,该 Rows 属性返回指定插入位置中的行。 Select 不能 GetChildRows 。 例如,当您以 XML 形式写入内容 DataRowCollection 时, WriteXml将按照指定的 DataRowCollection顺序写入行。

如果为 pos 参数指定的值大于集合中的行数,则新行将添加到末尾。

适用于