DataRowCollection.Add Method (Object[])

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Creates a row using specified values and adds it to the DataRowCollection.

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

member Add : 
        [<ParamArrayAttribute>] values:Object[] -> DataRow

Parameters

values
Type: System.Object[]

The array of values that are used to create the new row.

Return Value

Type: System.Data.DataRow

None.

Exception Condition
ArgumentException

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

InvalidCastException

A value does not match its respective column type.

ConstraintException

Adding the row invalidates a constraint.

NoNullAllowedException

Trying to put a null in a column where AllowDBNull is false.

If a DataColumn object has its AutoIncrement set to True, null should be passed to get the default value for that column.

Exceptions can also occur if you generate an exception during either a ColumnChanging or RowChanging event. If an exception occurs, the row is not added to the table.

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

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

.NET Framework
Available since 1.1
Return to top
Show: