DataRow.ItemArray Property

 

Gets or sets all the values for this row through an array.

Namespace:   System.Data
Assembly:  System.Data (in System.Data.dll)

member ItemArray : Object[] with get, set

Property Value

Type: System.Object[]

An array of type Object.

Exception Condition
ArgumentException

The array is larger than the number of columns in the table.

InvalidCastException

A value in the array does not match its DataType in its respective DataColumn.

ConstraintException

An edit broke a constraint.

ReadOnlyException

An edit tried to change the value of a read-only column.

NoNullAllowedException

An edit tried to put a null value in a column where AllowDBNull of the DataColumn object is false.

DeletedRowInaccessibleException

The row has been deleted.

You can use this property to set or get values for this row through an array. If you use this property to set values, the array must have the same size and ordering as the column collection. Passing null in the ItemArray indicates that no value was specified.

Users can generate exceptions in the ColumnChanging event or the RowChanging event.

The following examples show how to get and set values using the ItemArray property.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show: