DataTable.ImportRow(DataRow) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
public:
void ImportRow(System::Data::DataRow ^ row);
public void ImportRow (System.Data.DataRow? row);
public void ImportRow (System.Data.DataRow row);
member this.ImportRow : System.Data.DataRow -> unit
Public Sub ImportRow (row As DataRow)
Parameters
Remarks
Calling NewRow adds a row to the table using the existing table schema, but with default values for the row, and sets the DataRowState to Detached
. Calling ImportRow preserves the existing DataRowState along with other values in the row. If the DataRow
that is passed as a parameter is in a detached state, it is ignored, and no exception is thrown.
The new row will be added to the end of the data table.
If the new row violates a Constraint it won't be added to the data table.
You can get the index of the new row with as DataTable.Rows.Find and DataTable.Rows.IndexOf. See DataRowCollection and Rows for more information.