Export (0) Print
Expand All

DataTable.NewRow Method

Creates a new DataRow with the same schema as the table.

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

member NewRow : unit -> DataRow

Return Value

Type: System.Data.DataRow
A DataRow with the same schema as the DataTable.

You must use the NewRow method to create new DataRow objects with the same schema as the DataTable. After creating a DataRow, you can add it to the DataRowCollection, through the DataTable object's Rows property. When you use NewRow to create new rows, the rows must be added to or deleted from the data table before you call Clear.

The following example creates a DataTable, adds two DataColumn objects that determine the table's schema, and creates several new DataRow objects using the NewRow method. Those DataRow objects are then added to the DataRowCollection using the Add method.

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

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft