DataRow Class

Represents a row of data in a DataTable.

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

type DataRow =  class end

The DataRow type exposes the following members.

  NameDescription
Protected methodSupported by the XNA FrameworkDataRowInfrastructure. Initializes a new instance of the DataRow. Constructs a row from the builder. Only for internal usage..
Top

  NameDescription
Public propertySupported by the XNA FrameworkHasErrorsGets a value that indicates whether there are errors in a row.
Public propertySupported by the XNA FrameworkItem(DataColumn)Gets or sets the data stored in the specified DataColumn.
Public propertySupported by the XNA FrameworkItem(Int32)Gets or sets the data stored in the column specified by index.
Public propertySupported by the XNA FrameworkItem(String)Gets or sets the data stored in the column specified by name.
Public propertySupported by the XNA FrameworkItem(DataColumn, DataRowVersion)Gets the specified version of data stored in the specified DataColumn.
Public propertySupported by the XNA FrameworkItem(Int32, DataRowVersion)Gets the data stored in the column, specified by index and version of the data to retrieve.
Public propertySupported by the XNA FrameworkItem(String, DataRowVersion)Gets the specified version of data stored in the named column.
Public propertySupported by the XNA FrameworkItemArrayGets or sets all the values for this row through an array.
Public propertySupported by the XNA FrameworkRowErrorGets or sets the custom error description for a row.
Public propertySupported by the XNA FrameworkRowStateGets the current state of the row with regard to its relationship to the DataRowCollection.
Public propertySupported by the XNA FrameworkTableGets the DataTable for which this row has a schema.
Top

  NameDescription
Public methodSupported by the XNA FrameworkAcceptChangesCommits all the changes made to this row since the last time AcceptChanges was called.
Public methodSupported by the XNA FrameworkBeginEditStarts an edit operation on a DataRow object.
Public methodSupported by the XNA FrameworkCancelEditCancels the current edit on the row.
Public methodSupported by the XNA FrameworkClearErrorsClears the errors for the row. This includes the RowError and errors set with SetColumnError.
Public methodSupported by the XNA FrameworkDeleteDeletes the DataRow.
Public methodSupported by the XNA FrameworkEndEditEnds the edit occurring on the row.
Public methodSupported by the XNA FrameworkEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodSupported by the XNA FrameworkFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodSupported by the XNA FrameworkGetChildRows(DataRelation)Gets the child rows of this DataRow using the specified DataRelation.
Public methodSupported by the XNA FrameworkGetChildRows(String)Gets the child rows of a DataRow using the specified RelationName of a DataRelation.
Public methodSupported by the XNA FrameworkGetChildRows(DataRelation, DataRowVersion)Gets the child rows of a DataRow using the specified DataRelation, and DataRowVersion.
Public methodSupported by the XNA FrameworkGetChildRows(String, DataRowVersion)Gets the child rows of a DataRow using the specified RelationName of a DataRelation, and DataRowVersion.
Public methodSupported by the XNA FrameworkGetColumnError(DataColumn)Gets the error description of the specified DataColumn.
Public methodSupported by the XNA FrameworkGetColumnError(Int32)Gets the error description for the column specified by index.
Public methodSupported by the XNA FrameworkGetColumnError(String)Gets the error description for a column, specified by name.
Public methodSupported by the XNA FrameworkGetColumnsInErrorGets an array of columns that have errors.
Public methodSupported by the XNA FrameworkGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodSupported by the XNA FrameworkGetParentRow(DataRelation)Gets the parent row of a DataRow using the specified DataRelation.
Public methodSupported by the XNA FrameworkGetParentRow(String)Gets the parent row of a DataRow using the specified RelationName of a DataRelation.
Public methodSupported by the XNA FrameworkGetParentRow(DataRelation, DataRowVersion)Gets the parent row of a DataRow using the specified DataRelation, and DataRowVersion.
Public methodSupported by the XNA FrameworkGetParentRow(String, DataRowVersion)Gets the parent row of a DataRow using the specified RelationName of a DataRelation, and DataRowVersion.
Public methodSupported by the XNA FrameworkGetParentRows(DataRelation)Gets the parent rows of a DataRow using the specified DataRelation.
Public methodSupported by the XNA FrameworkGetParentRows(String)Gets the parent rows of a DataRow using the specified RelationName of a DataRelation.
Public methodSupported by the XNA FrameworkGetParentRows(DataRelation, DataRowVersion)Gets the parent rows of a DataRow using the specified DataRelation, and DataRowVersion.
Public methodSupported by the XNA FrameworkGetParentRows(String, DataRowVersion)Gets the parent rows of a DataRow using the specified RelationName of a DataRelation, and DataRowVersion.
Public methodSupported by the XNA FrameworkGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodSupported by the XNA FrameworkHasVersionGets a value that indicates whether a specified version exists.
Public methodSupported by the XNA FrameworkIsNull(DataColumn)Gets a value that indicates whether the specified DataColumn contains a null value.
Public methodSupported by the XNA FrameworkIsNull(Int32)Gets a value that indicates whether the column at the specified index contains a null value.
Public methodSupported by the XNA FrameworkIsNull(String)Gets a value that indicates whether the named column contains a null value.
Public methodSupported by the XNA FrameworkIsNull(DataColumn, DataRowVersion)Gets a value that indicates whether the specified DataColumn and DataRowVersion contains a null value.
Protected methodSupported by the XNA FrameworkMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodSupported by the XNA FrameworkRejectChangesRejects all changes made to the row since AcceptChanges was last called.
Public methodSupported by the XNA FrameworkSetAddedChanges the Rowstate of a DataRow to Added.
Public methodSupported by the XNA FrameworkSetColumnError(DataColumn, String)Sets the error description for a column specified as a DataColumn.
Public methodSupported by the XNA FrameworkSetColumnError(Int32, String)Sets the error description for a column specified by index.
Public methodSupported by the XNA FrameworkSetColumnError(String, String)Sets the error description for a column specified by name.
Public methodSupported by the XNA FrameworkSetModifiedChanges the Rowstate of a DataRow to Modified.
Protected methodSupported by the XNA FrameworkSetNullSets the value of the specified DataColumn to a null value.
Public methodSupported by the XNA FrameworkSetParentRow(DataRow)Sets the parent row of a DataRow with specified new parent DataRow.
Public methodSupported by the XNA FrameworkSetParentRow(DataRow, DataRelation)Sets the parent row of a DataRow with specified new parent DataRow and DataRelation.
Public methodSupported by the XNA FrameworkToStringReturns a string that represents the current object. (Inherited from Object.)
Top

  NameDescription
Public Extension MethodField(T)(DataColumn)Overloaded. Provides strongly-typed access to each of the column values in the specified row. The Field method also supports nullable types. (Defined by DataRowExtensions.)
Public Extension MethodField(T)(Int32)Overloaded. Provides strongly-typed access to each of the column values in the specified row. The Field method also supports nullable types. (Defined by DataRowExtensions.)
Public Extension MethodField(T)(String)Overloaded. Provides strongly-typed access to each of the column values in the specified row. The Field method also supports nullable types. (Defined by DataRowExtensions.)
Public Extension MethodField(T)(DataColumn, DataRowVersion)Overloaded. Provides strongly-typed access to each of the column values in the specified row. The Field method also supports nullable types. (Defined by DataRowExtensions.)
Public Extension MethodField(T)(Int32, DataRowVersion)Overloaded. Provides strongly-typed access to each of the column values in the specified row. The Field method also supports nullable types. (Defined by DataRowExtensions.)
Public Extension MethodField(T)(String, DataRowVersion)Overloaded. Provides strongly-typed access to each of the column values in the specified row. The Field method also supports nullable types. (Defined by DataRowExtensions.)
Public Extension MethodSetField(T)(DataColumn, T)Overloaded. Sets a new value for the specified column in the DataRow. The SetField method also supports nullable types. (Defined by DataRowExtensions.)
Public Extension MethodSetField(T)(Int32, T)Overloaded. Sets a new value for the specified column in the DataRow the method is called on. The SetField method also supports nullable types. (Defined by DataRowExtensions.)
Public Extension MethodSetField(T)(String, T)Overloaded. Sets a new value for the specified column in the DataRow. The SetField method also supports nullable types. (Defined by DataRowExtensions.)
Top

The DataRow and DataColumn objects are primary components of a DataTable. Use the DataRow object and its properties and methods to retrieve and evaluate; and insert, delete, and update the values in the DataTable. The DataRowCollection represents the actual DataRow objects in the DataTable, and the DataColumnCollection contains the DataColumn objects that describe the schema of the DataTable. Use the overloaded Item property to return or set the value of a DataColumn.

Use the HasVersion and IsNull properties to determine the status of a particular row value, and the RowState property to determine the state of the row relative to its parent DataTable.

To create a new DataRow, use the NewRow method of the DataTable object. After creating a new DataRow, use the Add method to add the new DataRow to the DataRowCollection. Finally, call the AcceptChanges method of the DataTable object to confirm the addition. For more information about adding data to a DataTable, see Adding Data to a DataTable.

You can delete a DataRow from the DataRowCollection by calling the Remove method of the DataRowCollection, or by calling the Delete method of the DataRow object. The Remove method removes the row from the collection. In contrast, Delete marks the DataRow for removal. The actual removal occurs when you call AcceptChanges method. By calling Delete, you can programmatically check which rows are marked for removal before actually deleting them. For more information, see DataRow Deletion.

The following example creates a new DataRow by calling the NewRow method of the DataTable object.

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

.NET Framework

Supported in: 4.6, 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.

This type is safe for multithreaded read operations. You must synchronize any write operations.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft