Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
7781 lines (6972 sloc) 539 KB
<Type Name="DataTable" FullName="System.Data.DataTable">
<TypeSignature Language="C#" Value="public class DataTable : System.ComponentModel.MarshalByValueComponent, System.ComponentModel.IListSource, System.ComponentModel.ISupportInitializeNotification, System.Runtime.Serialization.ISerializable, System.Xml.Serialization.IXmlSerializable" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi serializable beforefieldinit DataTable extends System.ComponentModel.MarshalByValueComponent implements class System.ComponentModel.IListSource, class System.ComponentModel.ISupportInitialize, class System.ComponentModel.ISupportInitializeNotification, class System.Runtime.Serialization.ISerializable, class System.Xml.Serialization.IXmlSerializable" />
<TypeSignature Language="DocId" Value="T:System.Data.DataTable" />
<TypeSignature Language="VB.NET" Value="Public Class DataTable&#xA;Inherits MarshalByValueComponent&#xA;Implements IListSource, ISerializable, ISupportInitializeNotification, IXmlSerializable" />
<TypeSignature Language="C++ CLI" Value="public ref class DataTable : System::ComponentModel::MarshalByValueComponent, System::ComponentModel::IListSource, System::ComponentModel::ISupportInitializeNotification, System::Runtime::Serialization::ISerializable, System::Xml::Serialization::IXmlSerializable" />
<TypeSignature Language="F#" Value="type DataTable = class&#xA; inherit MarshalByValueComponent&#xA; interface IListSource&#xA; interface ISupportInitializeNotification&#xA; interface ISerializable&#xA; interface IXmlSerializable&#xA; interface ISupportInitialize" />
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
<BaseTypeName FrameworkAlternate="netframework-4.5">System.ComponentModel.MarshalByValueComponent</BaseTypeName>
</Base>
<Interfaces>
<Interface>
<InterfaceName>System.ComponentModel.IListSource</InterfaceName>
</Interface>
<Interface>
<InterfaceName>System.ComponentModel.ISupportInitialize</InterfaceName>
</Interface>
<Interface>
<InterfaceName>System.ComponentModel.ISupportInitializeNotification</InterfaceName>
</Interface>
<Interface>
<InterfaceName>System.Runtime.Serialization.ISerializable</InterfaceName>
</Interface>
<Interface>
<InterfaceName>System.Xml.Serialization.IXmlSerializable</InterfaceName>
</Interface>
</Interfaces>
<Attributes>
<Attribute FrameworkAlternate="netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.ComponentModel.DefaultEvent("RowChanging")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.ComponentModel.DefaultProperty("TableName")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.ComponentModel.DesignTimeVisible(false)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="xamarinmac-3.0">
<AttributeName>System.ComponentModel.Editor("Microsoft.VSDesigner.Data.Design.DataTableEditor, Microsoft.VSDesigner, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.ComponentModel.ToolboxItem(false)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netcore-2.0;netcore-2.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.Xml.Serialization.XmlSchemaProvider("GetDataTableSchema")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-1.1">
<AttributeName>System.ComponentModel.Editor("Microsoft.VSDesigner.Data.Design.DataTableEditor, Microsoft.VSDesigner, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(System.Drawing.Design.UITypeEditor))</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5">
<AttributeName>System.ComponentModel.Editor("Microsoft.VSDesigner.Data.Design.DataTableEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.ComponentModel.Editor("Microsoft.VSDesigner.Data.Design.DataTableEditor, Microsoft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="xamarinandroid-7.1;xamarinios-10.8">
<AttributeName>System.ComponentModel.Editor("Microsoft.VSDesigner.Data.Design.DataTableEditor, Microsoft.VSDesigner, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0">
<AttributeName>System.Serializable</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Represents one table of in-memory data.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Data.DataTable> is a central object in the ADO.NET library. Other objects that use the <xref:System.Data.DataTable> include the <xref:System.Data.DataSet> and the <xref:System.Data.DataView>.
When accessing <xref:System.Data.DataTable> objects, note that they are conditionally case sensitive. For example, if one <xref:System.Data.DataTable> is named "mydatatable" and another is named "Mydatatable", a string used to search for one of the tables is regarded as case sensitive. However, if "mydatatable" exists and "Mydatatable" does not, the search string is regarded as case insensitive. A <xref:System.Data.DataSet> can contain two <xref:System.Data.DataTable> objects that have the same <xref:System.Data.DataTable.TableName%2A> property value but different <xref:System.Data.DataTable.Namespace%2A> property values. For more information about working with <xref:System.Data.DataTable> objects, see [Creating a DataTable](~/docs/framework/data/adonet/dataset-datatable-dataview/creating-a-datatable.md).
If you are creating a <xref:System.Data.DataTable> programmatically, you must first define its schema by adding <xref:System.Data.DataColumn> objects to the <xref:System.Data.DataColumnCollection> (accessed through the <xref:System.Data.DataTable.Columns%2A> property). For more information about adding <xref:System.Data.DataColumn> objects, see [Adding Columns to a DataTable](~/docs/framework/data/adonet/dataset-datatable-dataview/adding-columns-to-a-datatable.md).
To add rows to a <xref:System.Data.DataTable>, you must first use the <xref:System.Data.DataTable.NewRow%2A> method to return a new <xref:System.Data.DataRow> object. The <xref:System.Data.DataTable.NewRow%2A> method returns a row with the schema of the <xref:System.Data.DataTable>, as it is defined by the table's <xref:System.Data.DataColumnCollection>. The maximum number of rows that a <xref:System.Data.DataTable> can store is 16,777,216. For more information, see [Adding Data to a DataTable](~/docs/framework/data/adonet/dataset-datatable-dataview/adding-data-to-a-datatable.md).
The <xref:System.Data.DataTable> also contains a collection of <xref:System.Data.Constraint> objects that can be used to ensure the integrity of the data. For more information, see [DataTable Constraints](~/docs/framework/data/adonet/dataset-datatable-dataview/datatable-constraints.md).
There are many <xref:System.Data.DataTable> events that can be used to determine when changes are made to a table. These include <xref:System.Data.DataTable.RowChanged>, <xref:System.Data.DataTable.RowChanging>, <xref:System.Data.DataTable.RowDeleting>, and <xref:System.Data.DataTable.RowDeleted>. For more information about the events that can be used with a <xref:System.Data.DataTable>, see [Handling DataTable Events](~/docs/framework/data/adonet/dataset-datatable-dataview/handling-datatable-events.md).
When an instance of <xref:System.Data.DataTable> is created, some of the read/write properties are set to initial values. For a list of these values, see the <xref:System.Data.DataTable.%23ctor%2A?displayProperty=nameWithType> constructor topic.
> [!NOTE]
> The <xref:System.Data.DataSet> and <xref:System.Data.DataTable> objects inherit from <xref:System.ComponentModel.MarshalByValueComponent>, and support the <xref:System.Runtime.Serialization.ISerializable> interface for .NET Framework remoting. These are the only ADO.NET objects that you can use for .NET Framework remoting.
## Examples
The following example creates two <xref:System.Data.DataTable> objects and one <xref:System.Data.DataRelation> object, and adds the new objects to a <xref:System.Data.DataSet>. The tables are then displayed in a <xref:System.Windows.Forms.DataGridView> control.
[!code-csharp[Classic WebData DataTable Example#1](~/samples/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataTable Example/CS/source.cs#1)]
[!code-vb[Classic WebData DataTable Example#1](~/samples/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataTable Example/VB/source.vb#1)]
This sample demonstrates how to create a DataTable manually with specific schema definitions:
- Create multiple DataTables and define the initial columns.
- Create the table constraints.
- Insert the values and display the tables.
- Create the expression columns and display the tables.
C# and Visual Basic projects with this code sample can be found on [Developer Code Samples](https://code.msdn.microsoft.com/How-to-create-DataTable-7abb4914).
[!code-csharp[Classic WebData DataTable Example2#1](~/samples/snippets/csharp/VS_Snippets_ADO.NET/classic webdata datatable example2/cs/source.cs#1)]
[!code-vb[Classic WebData DataTable Example2#1](~/samples/snippets/visualbasic/VS_Snippets_ADO.NET/classic webdata datatable example2/vb/source.vb#1)]
]]></format>
</remarks>
<threadsafe>This type is safe for multithreaded read operations. You must synchronize any write operations.</threadsafe>
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
</Docs>
<Members>
<MemberGroup MemberName=".ctor">
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.Data.DataTable" /> class.</summary>
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
</Docs>
</MemberGroup>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public DataTable ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Data.DataTable.#ctor" />
<MemberSignature Language="VB.NET" Value="Public Sub New ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; DataTable();" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<Parameters />
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.Data.DataTable" /> class with no arguments.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The constructor sets initial values for all properties of the <xref:System.Data.DataTable> object. The following table shows the properties and their default values. When an instance of <xref:System.Data.DataTable> is created, the following read/write properties are set to initial values.
|Property|Default value|
|--------------|-------------------|
|**CaseSensitive**|Same as the parent <xref:System.Data.DataSet>, if it belongs to one. Otherwise, `false`.|
|**DisplayExpression**|Empty string ("")|
|**Locale**|Same as the parent <xref:System.Data.DataSet> object's <xref:System.Globalization.CultureInfo> (returned by the <xref:System.Data.DataSet.Locale%2A> property); if no parent exists, the default is the current system <xref:System.Globalization.CultureInfo>.|
|**MinimumCapacity**|50 rows.|
You can change the value for any of these properties through a separate call to the property.
## Examples
The following example creates a new <xref:System.Data.DataTable> with <xref:System.Data.DataColumn> and <xref:System.Data.DataRow>, and displays it in a <xref:System.Windows.Forms.DataGridView> control.
[!code-csharp[Classic WebData DataTable.DataTable Example#1](~/samples/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataTable.DataTable Example/CS/source.cs#1)]
[!code-vb[Classic WebData DataTable.DataTable Example#1](~/samples/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataTable.DataTable Example/VB/source.vb#1)]
]]></format>
</remarks>
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public DataTable (string tableName);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string tableName) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Data.DataTable.#ctor(System.String)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (tableName As String)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; DataTable(System::String ^ tableName);" />
<MemberSignature Language="F#" Value="new System.Data.DataTable : string -&gt; System.Data.DataTable" Usage="new System.Data.DataTable tableName" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="tableName" Type="System.String" Index="0" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1" />
</Parameters>
<Docs>
<param name="tableName">The name to give the table. If <paramref name="tableName" /> is <see langword="null" /> or an empty string, a default name is given when added to the <see cref="T:System.Data.DataTableCollection" />.</param>
<summary>Initializes a new instance of the <see cref="T:System.Data.DataTable" /> class with the specified table name.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
The following example creates a <xref:System.Data.DataTable> and displays it in a <xref:System.Windows.Forms.DataGridView> control.
[!code-csharp[Classic WebData DataTable.DataTable1 Example#1](~/samples/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataTable.DataTable1 Example/CS/source.cs#1)]
[!code-vb[Classic WebData DataTable.DataTable1 Example#1](~/samples/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataTable.DataTable1 Example/VB/source.vb#1)]
]]></format>
</remarks>
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="protected DataTable (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor(class System.Runtime.Serialization.SerializationInfo info, valuetype System.Runtime.Serialization.StreamingContext context) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Data.DataTable.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)" />
<MemberSignature Language="VB.NET" Value="Protected Sub New (info As SerializationInfo, context As StreamingContext)" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; DataTable(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);" />
<MemberSignature Language="F#" Value="new System.Data.DataTable : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -&gt; System.Data.DataTable" Usage="new System.Data.DataTable (info, context)" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="info" Type="System.Runtime.Serialization.SerializationInfo" Index="0" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1" />
<Parameter Name="context" Type="System.Runtime.Serialization.StreamingContext" Index="1" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1" />
</Parameters>
<Docs>
<param name="info">The data needed to serialize or deserialize an object.</param>
<param name="context">The source and destination of a given serialized stream.</param>
<summary>Initializes a new instance of the <see cref="T:System.Data.DataTable" /> class with the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> and the <see cref="T:System.Runtime.Serialization.StreamingContext" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This implementation of the <xref:System.Data.DataTable> constructor is required for <xref:System.Runtime.Serialization.ISerializable>.
]]></format>
</remarks>
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public DataTable (string tableName, string tableNamespace);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string tableName, string tableNamespace) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Data.DataTable.#ctor(System.String,System.String)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (tableName As String, tableNamespace As String)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; DataTable(System::String ^ tableName, System::String ^ tableNamespace);" />
<MemberSignature Language="F#" Value="new System.Data.DataTable : string * string -&gt; System.Data.DataTable" Usage="new System.Data.DataTable (tableName, tableNamespace)" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="tableName" Type="System.String" Index="0" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1" />
<Parameter Name="tableNamespace" Type="System.String" Index="1" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1" />
</Parameters>
<Docs>
<param name="tableName">The name to give the table. If <paramref name="tableName" /> is <see langword="null" /> or an empty string, a default name is given when added to the <see cref="T:System.Data.DataTableCollection" />.</param>
<param name="tableNamespace">The namespace for the XML representation of the data stored in the <see langword="DataTable" />.</param>
<summary>Initializes a new instance of the <see cref="T:System.Data.DataTable" /> class using the specified table name and namespace.</summary>
<remarks>To be added.</remarks>
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
</Docs>
</Member>
<Member MemberName="AcceptChanges">
<MemberSignature Language="C#" Value="public void AcceptChanges ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void AcceptChanges() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Data.DataTable.AcceptChanges" />
<MemberSignature Language="VB.NET" Value="Public Sub AcceptChanges ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; void AcceptChanges();" />
<MemberSignature Language="F#" Value="member this.AcceptChanges : unit -&gt; unit" Usage="dataTable.AcceptChanges " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Commits all the changes made to this table since the last time <see cref="M:System.Data.DataTable.AcceptChanges" /> was called.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
When <xref:System.Data.DataTable.AcceptChanges%2A> is called, any <xref:System.Data.DataRow> object still in edit mode successfully ends its edits. The <xref:System.Data.DataRowState> also changes: all `Added` and `Modified` rows become `Unchanged`, and `Deleted` rows are removed.
The <xref:System.Data.DataTable.AcceptChanges%2A> method is generally called on a <xref:System.Data.DataTable> after you attempt to update the <xref:System.Data.DataSet> using the <xref:System.Data.Common.DbDataAdapter.Update%2A?displayProperty=nameWithType> method.
## Examples
The following example tests each table for errors. If the table's errors can be reconciled (by passing it to an undefined function), <xref:System.Data.DataTable.AcceptChanges%2A> is called; otherwise, <xref:System.Data.DataTable.RejectChanges%2A> is called.
[!code-csharp[Classic WebData DataTable.AcceptChanges Example#1](~/samples/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataTable.AcceptChanges Example/CS/source.cs#1)]
[!code-vb[Classic WebData DataTable.AcceptChanges Example#1](~/samples/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataTable.AcceptChanges Example/VB/source.vb#1)]
]]></format>
</remarks>
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
</Docs>
</Member>
<Member MemberName="BeginInit">
<MemberSignature Language="C#" Value="public virtual void BeginInit ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void BeginInit() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Data.DataTable.BeginInit" />
<MemberSignature Language="VB.NET" Value="Public Overridable Sub BeginInit ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual void BeginInit();" />
<MemberSignature Language="F#" Value="abstract member BeginInit : unit -&gt; unit&#xA;override this.BeginInit : unit -&gt; unit" Usage="dataTable.BeginInit " />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.ComponentModel.ISupportInitialize.BeginInit</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Begins the initialization of a <see cref="T:System.Data.DataTable" /> that is used on a form or used by another component. The initialization occurs at run time.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The Visual Studio .NET design environment uses this method to start the initialization of a component that is used on a form or used by another component. The <xref:System.Data.DataTable.EndInit%2A> method ends the initialization. Using the <xref:System.Data.DataTable.BeginInit%2A> and <xref:System.Data.DataTable.EndInit%2A> methods prevents the control from being used before it is fully initialized.
]]></format>
</remarks>
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
</Docs>
</Member>
<Member MemberName="BeginLoadData">
<MemberSignature Language="C#" Value="public void BeginLoadData ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void BeginLoadData() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Data.DataTable.BeginLoadData" />
<MemberSignature Language="VB.NET" Value="Public Sub BeginLoadData ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; void BeginLoadData();" />
<MemberSignature Language="F#" Value="member this.BeginLoadData : unit -&gt; unit" Usage="dataTable.BeginLoadData " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Turns off notifications, index maintenance, and constraints while loading data.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use <xref:System.Data.DataTable.BeginLoadData%2A> in conjunction with <xref:System.Data.DataTable.LoadDataRow%2A> and <xref:System.Data.DataTable.EndLoadData%2A>.
]]></format>
</remarks>
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
</Docs>
</Member>
<Member MemberName="CaseSensitive">
<MemberSignature Language="C#" Value="public bool CaseSensitive { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool CaseSensitive" />
<MemberSignature Language="DocId" Value="P:System.Data.DataTable.CaseSensitive" />
<MemberSignature Language="VB.NET" Value="Public Property CaseSensitive As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property bool CaseSensitive { bool get(); void set(bool value); };" />
<MemberSignature Language="F#" Value="member this.CaseSensitive : bool with get, set" Usage="System.Data.DataTable.CaseSensitive" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-1.1">
<AttributeName>System.Data.DataSysDescription("DataTableCaseSensitiveDescr")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Indicates whether string comparisons within the table are case-sensitive.</summary>
<value>
<see langword="true" /> if the comparison is case-sensitive; otherwise <see langword="false" />. The default is set to the parent <see cref="T:System.Data.DataSet" /> object's <see cref="P:System.Data.DataSet.CaseSensitive" /> property, or <see langword="false" /> if the <see cref="T:System.Data.DataTable" /> was created independently of a <see cref="T:System.Data.DataSet" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Data.DataTable.CaseSensitive%2A> property affects string comparisons in sorting, searching, and filtering.
## Examples
The following example calls the <xref:System.Data.DataTable.Select%2A> method twice on a <xref:System.Data.DataTable>. The first time, the <xref:System.Data.DataTable.CaseSensitive%2A> property is set to `false`, the second, to `true`.
[!code-csharp[Classic WebData DataTable.CaseSensitive Example#1](~/samples/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataTable.CaseSensitive Example/CS/source.cs#1)]
[!code-vb[Classic WebData DataTable.CaseSensitive Example#1](~/samples/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataTable.CaseSensitive Example/VB/source.vb#1)]
]]></format>
</remarks>
<altmember cref="M:System.Data.DataTable.Select" />
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
</Docs>
</Member>
<Member MemberName="ChildRelations">
<MemberSignature Language="C#" Value="public System.Data.DataRelationCollection ChildRelations { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Data.DataRelationCollection ChildRelations" />
<MemberSignature Language="DocId" Value="P:System.Data.DataTable.ChildRelations" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property ChildRelations As DataRelationCollection" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Data::DataRelationCollection ^ ChildRelations { System::Data::DataRelationCollection ^ get(); };" />
<MemberSignature Language="F#" Value="member this.ChildRelations : System.Data.DataRelationCollection" Usage="System.Data.DataTable.ChildRelations" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;netcore-2.2;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;xamarinmac-3.0;netcore-3.0;netstandard-2.1">
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-1.1">
<AttributeName>System.Data.DataSysDescription("DataTableChildRelationsDescr")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Data.DataRelationCollection</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the collection of child relations for this <see cref="T:System.Data.DataTable" />.</summary>
<value>A <see cref="T:System.Data.DataRelationCollection" /> that contains the child relations for the table. An empty collection is returned if no <see cref="T:System.Data.DataRelation" /> objects exist.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
A <xref:System.Data.DataRelation> defines the relationship between two tables. Typically, two tables are linked through a single field that contains the same data. For example, a table which contains address data may have a single field containing codes that represent countries/regions. A second table that contains country/region data will have a single field that contains the code that identifies the country/region, and it is this code which is inserted into the corresponding field in the first table. A <xref:System.Data.DataRelation>, then, contains at least four pieces of information: (1) the name of the first table, (2) the column name in the first table, (3) the name of the second table, and (4) the column name in the second table.
## Examples
The following example uses the <xref:System.Data.DataTable.ChildRelations%2A> property to return each child <xref:System.Data.DataRelation> in a <xref:System.Data.DataTable>. Each relation is then used as an argument in the <xref:System.Data.DataRow.GetChildRows%2A> method of the <xref:System.Data.DataRow> to return an array of rows. The value of each column in the row is then printed.
[!code-csharp[Classic WebData DataTable.ChildRelations Example#1](~/samples/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataTable.ChildRelations Example/CS/source.cs#1)]
[!code-vb[Classic WebData DataTable.ChildRelations Example#1](~/samples/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataTable.ChildRelations Example/VB/source.vb#1)]
]]></format>
</remarks>
<altmember cref="P:System.Data.DataTable.ParentRelations" />
<altmember cref="M:System.Data.DataRow.GetParentRows(System.String)" />
<altmember cref="M:System.Data.DataRow.GetChildRows(System.String)" />
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
</Docs>
</Member>
<Member MemberName="Clear">
<MemberSignature Language="C#" Value="public void Clear ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Clear() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Data.DataTable.Clear" />
<MemberSignature Language="VB.NET" Value="Public Sub Clear ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; void Clear();" />
<MemberSignature Language="F#" Value="member this.Clear : unit -&gt; unit" Usage="dataTable.Clear " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Clears the <see cref="T:System.Data.DataTable" /> of all data.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
All rows in all tables are removed. An exception is generated if the table has any enforced child relations that would cause child rows to be orphaned.
If the <xref:System.Data.DataSet> is bound to an <xref:System.Xml.XmlDataDocument>, calling <xref:System.Data.DataSet.Clear%2A?displayProperty=nameWithType> or <xref:System.Data.DataTable.Clear%2A?displayProperty=nameWithType> raises the <xref:System.NotSupportedException>. To avoid this situation, traverse each table, removing each row one at a time. When you use <xref:System.Data.DataTable.NewRow%2A> to create new rows, the rows must be processed before you call <xref:System.Data.DataTable.Clear%2A>.
## Examples
The following example clears the table of all data.
[!code-csharp[Classic WebData DataTable.Clear Example#1](~/samples/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataTable.Clear Example/CS/source.cs#1)]
[!code-vb[Classic WebData DataTable.Clear Example#1](~/samples/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataTable.Clear Example/VB/source.vb#1)]
]]></format>
</remarks>
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
<related type="Article" href="https://msdn.microsoft.com/library/62f404a5-13ea-4b93-a29f-55b74a16c9d3">Working with DataTable Events</related>
</Docs>
</Member>
<Member MemberName="Clone">
<MemberSignature Language="C#" Value="public virtual System.Data.DataTable Clone ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Data.DataTable Clone() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Data.DataTable.Clone" />
<MemberSignature Language="VB.NET" Value="Public Overridable Function Clone () As DataTable" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual System::Data::DataTable ^ Clone();" />
<MemberSignature Language="F#" Value="abstract member Clone : unit -&gt; System.Data.DataTable&#xA;override this.Clone : unit -&gt; System.Data.DataTable" Usage="dataTable.Clone " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Data.DataTable</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Clones the structure of the <see cref="T:System.Data.DataTable" />, including all <see cref="T:System.Data.DataTable" /> schemas and constraints.</summary>
<returns>A new <see cref="T:System.Data.DataTable" /> with the same schema as the current <see cref="T:System.Data.DataTable" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
If these classes have been derived, the clone will also be of the same derived classes.
Clone creates a new <xref:System.Data.DataTable> with the same structure as the original <xref:System.Data.DataTable>, but does not copy any data (the new <xref:System.Data.DataTable> will not contain any `DataRows`). To copy both the structure and data into a new <xref:System.Data.DataTable>, use <xref:System.Data.DataTable.Copy%2A>.
## Examples
The following sample demonstrates how to update the structure and constraints of the destination table after you execute DataTable.Clone. The ClonedDataTable class will return a destination table and includes all the updating events. After the clone, structure changes in the source table won't be reflected in the destination table. Specifically, this sample will:
- Update the changes of the columns in source table.
- Update the changes of the UniqueConstraint in source table.
- Update the changes of the ForeignKeyConstraint in source table.
C# and Visual Basic projects with this code sample can be found on [Developer Code Samples](https://code.msdn.microsoft.com/site/search?f%5B0%5D.Type=SearchText&f%5B0%5D.Value=How%20to%20automically%20update%20the%20structure%20of%20a%20cloned%20DataTable).
```csharp
using System;
using System.Linq;
using System.Data;
using System.ComponentModel;
class Program {
static void Main(string[] args) {
DataTable courses = NewCourseDataTable();
Console.WriteLine("This is the source table:");
WriteDataTable(courses);
ClonedDataTable clonedResult = new ClonedDataTable(courses);
DataTable clonedCourses = clonedResult.DestinationTable;
Console.WriteLine("This is the destination table:");
WriteDataTable(clonedCourses);
// Add the events of updating column collection into the source table.
clonedResult.UpdateAddedColumn();
clonedResult.UpdateDeletedColumn();
// Add a DataColumn in source table.
DataColumn columnCredits = new DataColumn("Credits", typeof(Int32));
courses.Columns.Add(columnCredits);
Console.WriteLine("After add a column in source table, it's the result in the destination:");
WriteDataTable(clonedCourses);
// Add the event of updating UniqueConstraint into the source table.
clonedResult.UpdateUniqueConstraint();
// Add the unique constraint in source table.
UniqueConstraint uniqueConstraint = new UniqueConstraint(courses.Columns["CourseId"]);
courses.Constraints.Add(uniqueConstraint);
Console.WriteLine(@"If we add the unique constraint in source table and then insert the duplicate
rows into the destination table, we will get the following error:");
InsertDuplicateData(clonedCourses);
Console.WriteLine();
// Add the event of updating ForeignKeyConstraint into the source table.
clonedResult.UpdateForeignKeyConstraint();
// Add the ForeignKeyConstraint into the source table.
DataTable departments = NewDepartmentDataTable();
DataSet dataset = new DataSet();
dataset.Tables.Add(courses);
dataset.Tables.Add(clonedCourses);
dataset.Tables.Add(departments);
ForeignKeyConstraint foreignKey = new ForeignKeyConstraint(departments.Columns["DepartmentId"], courses.Columns["DepartmentId"]);
courses.Constraints.Add(foreignKey);
Console.WriteLine(@"If we add the foreign key constraint in source table and then insert a row
without the parent into the destination table, we will get the following error:");
InsertNoParentRow(clonedCourses);
Console.WriteLine();
Console.WriteLine("Please press any key to exit...");
Console.ReadKey();
}
static private DataTable NewCourseDataTable() {
DataTable newTable = new DataTable();
DataColumn[] columns ={
new DataColumn("CourseId", typeof(String)),
new DataColumn("CourseName",typeof(String)),
new DataColumn("DepartmentId", typeof(Int32))
};
newTable.Columns.AddRange(columns);
newTable.Rows.Add("C1045", "Calculus", 7);
newTable.Rows.Add("C1061", "Physics", 1);
newTable.Rows.Add("C2021", "Composition", 2);
newTable.Rows.Add("C2042", "Literature", 2);
return newTable;
}
static private DataTable NewDeparmentDataTable() {
DataTable newTable = new DataTable();
DataColumn[] columns ={
new DataColumn("DepartmentId", typeof(Int32)),
new DataColumn("Name",typeof(String)),
};
newTable.Columns.AddRange(columns);
newTable.Rows.Add(1, "Engineering");
newTable.Rows.Add(2, "English");
newTable.Rows.Add(4, "Economics");
newTable.Rows.Add(7, "Mathematics");
return newTable;
}
static private void WriteDataTable(DataTable table) {
if (table == null)
return;
foreach (DataColumn column in table.Columns) {
Console.Write("{0,-15}", column.ColumnName);
}
Console.WriteLine();
foreach (DataRow row in table.Rows) {
for (int i = 0; i < table.Columns.Count; i++)
Console.Write("{0,-15}", row[i].ToString());
Console.WriteLine();
}
Console.WriteLine();
}
static private void InsertDuplicateData(DataTable table) {
try {
table.Rows.Add("C1045", "Calculus", 7);
table.Rows.Add("C1045", "Calculus", 7);
} catch (Exception e) {
Console.WriteLine("\"" + e.Message + "\"");
}
}
private static void InsertNoParentRow(DataTable table) {
try {
table.Rows.Add("C1061", "Physics", 11);
} catch (Exception e) {
Console.WriteLine("\"" + e.Message + "\"");
}
}
}
public class ClonedDataTable {
private DataTable sourceTable;
private DataTable destinationTable;
public ClonedDataTable(DataTable source) {
sourceTable = source;
// set the cloned result
destinationTable = sourceTable.Clone();
}
public void UpdateAddedColumn() {
sourceTable.Columns.CollectionChanged += new CollectionChangeEventHandler(ColumnAdded);
}
public void UpdateDeletedColumn() {
sourceTable.Columns.CollectionChanged += new CollectionChangeEventHandler(ColumnDeleted);
}
public void UpdateUniqueConstraint() {
sourceTable.Constraints.CollectionChanged += new CollectionChangeEventHandler(UniqueConstraint_Changed);
}
public void UpdateForeignKeyConstraint() {
sourceTable.Constraints.CollectionChanged += new CollectionChangeEventHandler(ForeignKeyConstraint_Changed);
}
// After the source table adds a column, the method will add the same column in the destination table.
void ColumnAdded(object sender, System.ComponentModel.CollectionChangeEventArgs e) {
if (e.Action == CollectionChangeAction.Add) {
DataColumn column = e.Element as DataColumn;
if (column != null) {
DataColumn newColumn = new DataColumn(column.ColumnName, column.DataType, column.Expression, column.ColumnMapping);
if (!destinationTable.Columns.Contains(newColumn.ColumnName))
destinationTable.Columns.Add(newColumn);
}
}
}
// After the source table deletes a column, the method will delete the same column in the destination table.
void ColumnDeleted(object sender, CollectionChangeEventArgs e) {
if (e.Action == CollectionChangeAction.Remove) {
DataColumn column = e.Element as DataColumn;
if (column != null)
if (destinationTable.Columns.Contains(column.ColumnName))
destinationTable.Columns.Remove(column.ColumnName);
}
}
// After the source table changes the UniqueConstraint, this method changes the same UniqueConstraint in destination table.
void UniqueConstraint_Changed(object sender, CollectionChangeEventArgs e) {
UniqueConstraint constraint = e.Element as UniqueConstraint;
if (constraint == null)
return;
String constraintName = constraint.ConstraintName;
if (e.Action == CollectionChangeAction.Add) {
DataColumn[] columns = new DataColumn[constraint.Columns.Count()];
Boolean isPrimaryKey = constraint.IsPrimaryKey;
// Get the columns used in new constraint from the destination table.
for (Int32 i = 0; i < constraint.Columns.Count(); i++) {
String columnName = constraint.Columns[i].ColumnName;
if (destinationTable.Columns.Contains(columnName))
columns[i] = destinationTable.Columns[columnName];
else
return;
}
UniqueConstraint newConstraint = new UniqueConstraint(constraintName, columns, isPrimaryKey);
if (!destinationTable.Constraints.Contains(constraintName))
destinationTable.Constraints.Add(newConstraint);
} else if (e.Action == CollectionChangeAction.Remove)
if (destinationTable.Constraints.Contains(constraintName))
destinationTable.Constraints.Remove(constraintName);
}
// After the source table changes the ForeignKeyConstraint, this method changes
// the same ForeignKeyConstraint in the destination table.
void ForeignKeyConstraint_Changed(object sender, CollectionChangeEventArgs e) {
ForeignKeyConstraint constraint = e.Element as ForeignKeyConstraint;
if (constraint == null)
return;
// If the source and destination are not in the same DataSet, don't change the ForeignKeyConstraint.
if (sourceTable.DataSet != destinationTable.DataSet)
return;
String constraintName = constraint.ConstraintName;
if (e.Action == CollectionChangeAction.Add) {
DataColumn[] columns = new DataColumn[constraint.Columns.Count()];
DataColumn[] parentColumns = constraint.RelatedColumns;
// Get the columns used in new constraint from the destination table.
for (int i = 0; i < constraint.Columns.Count(); i++) {
String columnName = constraint.Columns[i].ColumnName;
if (destinationTable.Columns.Contains(columnName))
columns[i] = destinationTable.Columns[columnName];
else
return;
}
ForeignKeyConstraint newConstraint = new ForeignKeyConstraint(constraintName, parentColumns, columns);
newConstraint.AcceptRejectRule = constraint.AcceptRejectRule;
newConstraint.DeleteRule = constraint.DeleteRule;
newConstraint.UpdateRule = constraint.UpdateRule;
if (!destinationTable.Constraints.Contains(constraintName))
destinationTable.Constraints.Add(newConstraint);
} else if (e.Action == CollectionChangeAction.Remove)
if (destinationTable.Constraints.Contains(constraintName))
destinationTable.Constraints.Remove(constraintName);
}
// return the destination table.
public DataTable DestinationTable {
get { return destinationTable; }
}
}
```
This sample shows how to modify data in a DataTable and update the data source.
First, create a database:
```
USE [master]
GO
CREATE DATABASE [MySchool]
GO
USE [MySchool]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Course]([CourseID] [nvarchar](10) NOT NULL,
[Year] [smallint] NOT NULL,
[Title] [nvarchar](100) NOT NULL,
[Credits] [int] NOT NULL,
[DepartmentID] [int] NOT NULL,
CONSTRAINT [PK_Course] PRIMARY KEY CLUSTERED
(
[CourseID] ASC,
[Year] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Department]([DepartmentID] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](50) NOT NULL,
[Budget] [money] NOT NULL,
[StartDate] [datetime] NOT NULL,
[Administrator] [int] NULL,
CONSTRAINT [PK_Department] PRIMARY KEY CLUSTERED
(
[DepartmentID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY]
GO
INSERT [dbo].[Course] ([CourseID], [Year], [Title], [Credits], [DepartmentID]) VALUES (N'C1045', 2012, N'Calculus', 4, 7)
INSERT [dbo].[Course] ([CourseID], [Year], [Title], [Credits], [DepartmentID]) VALUES (N'C1061', 2012, N'Physics', 4, 1)
INSERT [dbo].[Course] ([CourseID], [Year], [Title], [Credits], [DepartmentID]) VALUES (N'C2021', 2012, N'Composition', 3, 2)
INSERT [dbo].[Course] ([CourseID], [Year], [Title], [Credits], [DepartmentID]) VALUES (N'C2042', 2012, N'Literature', 4, 2)
SET IDENTITY_INSERT [dbo].[Department] ON
INSERT [dbo].[Department] ([DepartmentID], [Name], [Budget], [StartDate], [Administrator]) VALUES (1, N'Engineering', 350000.0000, CAST(0x0000999C00000000 AS DateTime), 2)
INSERT [dbo].[Department] ([DepartmentID], [Name], [Budget], [StartDate], [Administrator]) VALUES (2, N'English', 120000.0000, CAST(0x0000999C00000000 AS DateTime), 6)
INSERT [dbo].[Department] ([DepartmentID], [Name], [Budget], [StartDate], [Administrator]) VALUES (4, N'Economics', 200000.0000, CAST(0x0000999C00000000 AS DateTime), 4)
INSERT [dbo].[Department] ([DepartmentID], [Name], [Budget], [StartDate], [Administrator]) VALUES (7, N'Mathematics', 250024.0000, CAST(0x0000999C00000000 AS DateTime), 3)
SET IDENTITY_INSERT [dbo].[Department] OFF
ALTER TABLE [dbo].[Course] WITH CHECK ADD CONSTRAINT [FK_Course_Department] FOREIGN KEY([DepartmentID])
REFERENCES [dbo].[Department] ([DepartmentID])
GO
ALTER TABLE [dbo].[Course] CHECK CONSTRAINT [FK_Course_Department]
GO
```
You can now compile and run the sample. [How to modify data in DataTable and update to the data source](https://code.msdn.microsoft.com/How-to-modify-data-in-c68d35f4) has Visual Basic and C# projects of this sample.
```csharp
using System;
using System.Data;
using System.Data.SqlClient;
class Program {
static void Main(string[] args) {
string MySchoolConnectionString = "Data Source=(local);Initial Catalog=MySchool;Integrated Security=True";
// Get Data
String selectString =
@"Select [CourseID],[Year],[Title],[Credits],[DepartmentID] From [dbo].[Course];
Select [DepartmentID],[Name],[Budget],[StartDate],[Administrator] From [dbo].[Department] ";
DataSet dataSet = new DataSet();
DataTable course = dataSet.Tables.Add("Course");
DataTable department = dataSet.Tables.Add("Department");
Console.WriteLine("Get data from database:");
GetDataTables(MySchoolConnectionString, selectString, dataSet, course, department);
Console.WriteLine();
// Use DataTable Edits to edit the data
String updateString =
@"Update [dbo].[Course] Set [Credits]=@Credits Where [CourseID]=@CourseID;";
course.ColumnChanged += OnColumnChanged;
// Set the Credits of first row is negative value, and set the Credits of second row is plus.
ChangeCredits(course, course.Rows[0], -1);
ChangeCredits(course, course.Rows[1], 11);
UpdateDataTables(MySchoolConnectionString, updateString, dataSet, "Course",
new SqlParameter("@CourseID", SqlDbType.NVarChar, 10, "CourseID"),
new SqlParameter("@Credits", SqlDbType.Int, 4, "Credits"));
Console.WriteLine("Only the Credits of second row is changed.");
ShowDataTable(course);
Console.WriteLine();
// Delete and Remove from DataTable
// Create the foreign key constraint, and set the DeleteRule with Cascade.
ForeignKeyConstraint courseDepartFK = new ForeignKeyConstraint("CourseDepartFK", department.Columns["DepartmentID"], course.Columns["DepartmentID"]);
courseDepartFK.DeleteRule = Rule.Cascade;
courseDepartFK.UpdateRule = Rule.Cascade;
courseDepartFK.AcceptRejectRule = AcceptRejectRule.None;
course.Constraints.Add(courseDepartFK);
String deleteString = @"Delete From [dbo].[Course] Where [CourseID]=@CourseID;";
department.Rows[0].Delete();
Console.WriteLine("If One row in Department table is deleted, the related rows in Course table will also be deleted.");
Console.WriteLine("Department DataTable:");
ShowDataTable(department);
Console.WriteLine();
Console.WriteLine("Course DataTable:");
ShowDataTable(course);
Console.WriteLine();
// Update the delete operation
DeleteDataTables(MySchoolConnectionString, deleteString, dataSet, "Course",
new SqlParameter("@CourseID", SqlDbType.NVarChar, 10, "CourseID"));
Console.WriteLine("After delete operation:");
Console.WriteLine("Course DataTable:");
ShowDataTable(course);
Console.WriteLine();
course.Rows.RemoveAt(0);
Console.WriteLine("Now we remove one row from Course:");
ShowDataTable(course);
DeleteDataTables(MySchoolConnectionString, deleteString, dataSet, "Course",
new SqlParameter("@CourseID", SqlDbType.NVarChar, 10, "CourseID"));
}
// Use SqlDataAdapter to get data.
private static void GetDataTables(String connectionString, String selectString,
DataSet dataSet, params DataTable[] tables) {
using (SqlDataAdapter adapter = new SqlDataAdapter()) {
adapter.SelectCommand = new SqlCommand(selectString);
adapter.SelectCommand.Connection = new SqlConnection(connectionString);
adapter.Fill(0, 0, tables);
foreach (DataTable table in dataSet.Tables) {
Console.WriteLine("Data in {0}:", table.TableName);
ShowDataTable(table);
Console.WriteLine();
}
}
}
// Use SqlDataAdapter to update the updata operation.
private static void UpdateDataTables(String connectionString, String updateString,
DataSet dataSet, String tableName, params SqlParameter[] parameters) {
using (SqlDataAdapter adapter = new SqlDataAdapter()) {
adapter.UpdateCommand = new SqlCommand(updateString);
adapter.UpdateCommand.Parameters.AddRange(parameters);
adapter.UpdateCommand.Connection = new SqlConnection(connectionString);
adapter.Update(dataSet, tableName);
}
}
// Use SqlDataAdapter to update delete operation.
private static void DeleteDataTables(String connectionString, String deleteString,
DataSet dataSet, String tableName, params SqlParameter[] parameters) {
using (SqlDataAdapter adapter = new SqlDataAdapter()) {
adapter.DeleteCommand = new SqlCommand(deleteString);
adapter.DeleteCommand.Parameters.AddRange(parameters);
adapter.DeleteCommand.Connection = new SqlConnection(connectionString);
adapter.Update(dataSet, tableName);
}
}
// Use DataTable Edits to modify the data.
private static void ChangeCredits(DataTable table, DataRow row, Int32 credits) {
row.BeginEdit();
Console.WriteLine("We change row {0}", table.Rows.IndexOf(row));
row["Credits"] = credits;
row.EndEdit();
}
// The method will be invoked when the value in DataTable is changed.
private static void OnColumnChanged(Object sender, DataColumnChangeEventArgs args) {
Int32 credits = 0;
// If Credits is changed and the value is negative, we'll cancel the edit.
if ((args.Column.ColumnName == "Credits") &&
(!Int32.TryParse(args.ProposedValue.ToString(), out credits) || credits < 0)) {
Console.WriteLine("The value of Credits is invalid. Edit canceled.");
args.Row.CancelEdit();
}
}
// Display the column and value of DataTable.
private static void ShowDataTable(DataTable table) {
foreach (DataColumn col in table.Columns) {
Console.Write("{0,-14}", col.ColumnName);
}
Console.WriteLine("{0,-14}", "RowState");
foreach (DataRow row in table.Rows) {
if (row.RowState == DataRowState.Deleted) {
foreach (DataColumn col in table.Columns) {
if (col.DataType.Equals(typeof(DateTime)))
Console.Write("{0,-14:d}", row[col, DataRowVersion.Original]);
else if (col.DataType.Equals(typeof(Decimal)))
Console.Write("{0,-14:C}", row[col, DataRowVersion.Original]);
else
Console.Write("{0,-14}", row[col, DataRowVersion.Original]);
}
}
else {
foreach (DataColumn col in table.Columns) {
if (col.DataType.Equals(typeof(DateTime)))
Console.Write("{0,-14:d}", row[col]);
else if (col.DataType.Equals(typeof(Decimal)))
Console.Write("{0,-14:C}", row[col]);
else
Console.Write("{0,-14}", row[col]);
}
}
Console.WriteLine("{0,-14}", row.RowState);
}
}
}
```
]]></format>
</remarks>
<altmember cref="M:System.Data.DataTable.Copy" />
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
</Docs>
</Member>
<Member MemberName="ColumnChanged">
<MemberSignature Language="C#" Value="public event System.Data.DataColumnChangeEventHandler ColumnChanged;" />
<MemberSignature Language="ILAsm" Value=".event class System.Data.DataColumnChangeEventHandler ColumnChanged" />
<MemberSignature Language="DocId" Value="E:System.Data.DataTable.ColumnChanged" />
<MemberSignature Language="VB.NET" Value="Public Custom Event ColumnChanged As DataColumnChangeEventHandler " />
<MemberSignature Language="C++ CLI" Value="public:&#xA; event System::Data::DataColumnChangeEventHandler ^ ColumnChanged;" />
<MemberSignature Language="F#" Value="member this.ColumnChanged : System.Data.DataColumnChangeEventHandler " Usage="member this.ColumnChanged : System.Data.DataColumnChangeEventHandler " />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-1.1">
<AttributeName>System.Data.DataSysDescription("DataTableColumnChangedDescr")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Data.DataColumnChangeEventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs after a value has been changed for the specified <see cref="T:System.Data.DataColumn" /> in a <see cref="T:System.Data.DataRow" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
For more information, see [Handling DataTable Events](~/docs/framework/data/adonet/dataset-datatable-dataview/handling-datatable-events.md).
## Examples
[!code-csharp[Classic WebData DataTable.ColumnChanged Example#1](~/samples/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataTable.ColumnChanged Example/CS/source.cs#1)]
[!code-vb[Classic WebData DataTable.ColumnChanged Example#1](~/samples/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataTable.ColumnChanged Example/VB/source.vb#1)]
]]></format>
</remarks>
<altmember cref="T:System.Data.DataColumnChangeEventHandler" />
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
</Docs>
</Member>
<Member MemberName="ColumnChanging">
<MemberSignature Language="C#" Value="public event System.Data.DataColumnChangeEventHandler ColumnChanging;" />
<MemberSignature Language="ILAsm" Value=".event class System.Data.DataColumnChangeEventHandler ColumnChanging" />
<MemberSignature Language="DocId" Value="E:System.Data.DataTable.ColumnChanging" />
<MemberSignature Language="VB.NET" Value="Public Custom Event ColumnChanging As DataColumnChangeEventHandler " />
<MemberSignature Language="C++ CLI" Value="public:&#xA; event System::Data::DataColumnChangeEventHandler ^ ColumnChanging;" />
<MemberSignature Language="F#" Value="member this.ColumnChanging : System.Data.DataColumnChangeEventHandler " Usage="member this.ColumnChanging : System.Data.DataColumnChangeEventHandler " />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-1.1">
<AttributeName>System.Data.DataSysDescription("DataTableColumnChangingDescr")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Data.DataColumnChangeEventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs when a value is being changed for the specified <see cref="T:System.Data.DataColumn" /> in a <see cref="T:System.Data.DataRow" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
For more information, see [Handling DataTable Events](~/docs/framework/data/adonet/dataset-datatable-dataview/handling-datatable-events.md).
## Examples
[!code-csharp[Classic WebData DataTable.ColumnChanging Example#1](~/samples/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataTable.ColumnChanging Example/CS/source.cs#1)]
[!code-vb[Classic WebData DataTable.ColumnChanging Example#1](~/samples/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataTable.ColumnChanging Example/VB/source.vb#1)]
]]></format>
</remarks>
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
</Docs>
</Member>
<Member MemberName="Columns">
<MemberSignature Language="C#" Value="public System.Data.DataColumnCollection Columns { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Data.DataColumnCollection Columns" />
<MemberSignature Language="DocId" Value="P:System.Data.DataTable.Columns" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property Columns As DataColumnCollection" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Data::DataColumnCollection ^ Columns { System::Data::DataColumnCollection ^ get(); };" />
<MemberSignature Language="F#" Value="member this.Columns : System.Data.DataColumnCollection" Usage="System.Data.DataTable.Columns" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;netcore-2.2;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;xamarinmac-3.0;netcore-3.0;netstandard-2.1">
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-1.1">
<AttributeName>System.Data.DataSysDescription("DataTableColumnsDescr")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Data.DataColumnCollection</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the collection of columns that belong to this table.</summary>
<value>A <see cref="T:System.Data.DataColumnCollection" /> that contains the collection of <see cref="T:System.Data.DataColumn" /> objects for the table. An empty collection is returned if no <see cref="T:System.Data.DataColumn" /> objects exist.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Data.DataColumnCollection> determines the schema of a table by defining the data type of each column.
## Examples
The following example prints each value of each row in a table using the <xref:System.Data.DataTable.Columns%2A> property.
[!code-csharp[Classic WebData DataTable.Columns Example#1](~/samples/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataTable.Columns Example/CS/source.cs#1)]
[!code-vb[Classic WebData DataTable.Columns Example#1](~/samples/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataTable.Columns Example/VB/source.vb#1)]
]]></format>
</remarks>
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
</Docs>
</Member>
<Member MemberName="Compute">
<MemberSignature Language="C#" Value="public object Compute (string expression, string filter);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance object Compute(string expression, string filter) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Data.DataTable.Compute(System.String,System.String)" />
<MemberSignature Language="VB.NET" Value="Public Function Compute (expression As String, filter As String) As Object" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; System::Object ^ Compute(System::String ^ expression, System::String ^ filter);" />
<MemberSignature Language="F#" Value="member this.Compute : string * string -&gt; obj" Usage="dataTable.Compute (expression, filter)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Object</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="expression" Type="System.String" Index="0" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1" />
<Parameter Name="filter" Type="System.String" Index="1" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1" />
</Parameters>
<Docs>
<param name="expression">The expression to compute.</param>
<param name="filter">The filter to limit the rows that evaluate in the expression.</param>
<summary>Computes the given expression on the current rows that pass the filter criteria.</summary>
<returns>An <see cref="T:System.Object" />, set to the result of the computation. If the expression evaluates to null, the return value will be <see cref="F:System.DBNull.Value" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The `expression` parameter requires an aggregate function. For example, the following is a legal expression:
`Count(Quantity)`
But this expression is not:
`Sum (Quantity * UnitPrice)`
If you must perform an operation on two or more columns, you should create a <xref:System.Data.DataColumn>, set its <xref:System.Data.DataColumn.Expression%2A> property to an appropriate expression, and use an aggregate expression on the resulting column. In that case, given a <xref:System.Data.DataColumn> with the name "total", and the <xref:System.Data.DataColumn.Expression%2A> property set to this:
`"Quantity * UnitPrice"`
The expression argument for the <xref:System.Data.DataTable.Compute%2A> method would then be this:
`Sum(total)`
The second parameter, `filter`, determines which rows are used in the expression. For example, if the table contains a date column named "colDate", you could limit the rows with the following expression:
`colDate > 1/1/99 AND colDate < 17/1/99`
For rules on creating expressions for both parameters, see the <xref:System.Data.DataColumn.Expression%2A?displayProperty=nameWithType> property.
## Examples
The following example sums the values of a column named "Total", for the salesperson whose identification number is five.
[!code-csharp[Classic WebData DataTable.Compute Example#1](~/samples/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataTable.Compute Example/CS/source.cs#1)]
[!code-vb[Classic WebData DataTable.Compute Example#1](~/samples/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataTable.Compute Example/VB/source.vb#1)]
]]></format>
</remarks>
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
</Docs>
</Member>
<Member MemberName="Constraints">
<MemberSignature Language="C#" Value="public System.Data.ConstraintCollection Constraints { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Data.ConstraintCollection Constraints" />
<MemberSignature Language="DocId" Value="P:System.Data.DataTable.Constraints" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property Constraints As ConstraintCollection" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Data::ConstraintCollection ^ Constraints { System::Data::ConstraintCollection ^ get(); };" />
<MemberSignature Language="F#" Value="member this.Constraints : System.Data.ConstraintCollection" Usage="System.Data.DataTable.Constraints" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;netcore-2.2;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;xamarinmac-3.0;netcore-3.0;netstandard-2.1">
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-1.1">
<AttributeName>System.Data.DataSysDescription("DataTableConstraintsDescr")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Data.ConstraintCollection</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the collection of constraints maintained by this table.</summary>
<value>A <see cref="T:System.Data.ConstraintCollection" /> that contains the collection of <see cref="T:System.Data.Constraint" /> objects for the table. An empty collection is returned if no <see cref="T:System.Data.Constraint" /> objects exist.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
A <xref:System.Data.ForeignKeyConstraint> restricts the action performed when a value in a column (or columns) is either deleted or updated. Such a constraint is intended to be used with primary key columns. In a parent/child relationship between two tables, deleting a value from the parent table can affect the child rows in one of the following ways.
- The child rows can also be deleted (a cascading action).
- The values in the child column (or columns) can be set to null values.
- The values in the child column (or columns) can be set to default values.
- An exception can be generated.
A <xref:System.Data.UniqueConstraint> becomes active when attempting to set a value in a primary key to a non-unique value.
## Examples
The following example adds a <xref:System.Data.ForeignKeyConstraint> to the collection of constraints.
[!code-csharp[Classic WebData DataTable.Constraints Example#1](~/samples/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataTable.Constraints Example/CS/source.cs#1)]
[!code-vb[Classic WebData DataTable.Constraints Example#1](~/samples/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataTable.Constraints Example/VB/source.vb#1)]
]]></format>
</remarks>
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
</Docs>
</Member>
<Member MemberName="Copy">
<MemberSignature Language="C#" Value="public System.Data.DataTable Copy ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.Data.DataTable Copy() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Data.DataTable.Copy" />
<MemberSignature Language="VB.NET" Value="Public Function Copy () As DataTable" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; System::Data::DataTable ^ Copy();" />
<MemberSignature Language="F#" Value="member this.Copy : unit -&gt; System.Data.DataTable" Usage="dataTable.Copy " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Data.DataTable</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Copies both the structure and data for this <see cref="T:System.Data.DataTable" />.</summary>
<returns>A new <see cref="T:System.Data.DataTable" /> with the same structure (table schemas and constraints) and data as this <see cref="T:System.Data.DataTable" />.
If these classes have been derived, the copy will also be of the same derived classes.
<see cref="M:System.Data.DataTable.Copy" /> creates a new <see cref="T:System.Data.DataTable" /> with the same structure and data as the original <see cref="T:System.Data.DataTable" />. To copy the structure to a new <see cref="T:System.Data.DataTable" />, but not the data, use <see cref="M:System.Data.DataTable.Clone" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
The following example uses the <xref:System.Data.DataTable.Copy%2A> method to create a copy of the original <xref:System.Data.DataTable>. The namespace name is not retained if it is inherited from a parent <xref:System.Data.DataTable> or <xref:System.Data.DataSet>.
[!code-csharp[Classic WebData DataTable.Copy Example#1](~/samples/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataTable.Copy Example/CS/source.cs#1)]
[!code-vb[Classic WebData DataTable.Copy Example#1](~/samples/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataTable.Copy Example/VB/source.vb#1)]
]]></format>
</remarks>
<altmember cref="M:System.Data.DataView.ToTable" />
<altmember cref="M:System.Data.DataTable.Clone" />
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
</Docs>
</Member>
<Member MemberName="CreateDataReader">
<MemberSignature Language="C#" Value="public System.Data.DataTableReader CreateDataReader ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.Data.DataTableReader CreateDataReader() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Data.DataTable.CreateDataReader" />
<MemberSignature Language="VB.NET" Value="Public Function CreateDataReader () As DataTableReader" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; System::Data::DataTableReader ^ CreateDataReader();" />
<MemberSignature Language="F#" Value="member this.CreateDataReader : unit -&gt; System.Data.DataTableReader" Usage="dataTable.CreateDataReader " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Data.DataTableReader</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Returns a <see cref="T:System.Data.DataTableReader" /> corresponding to the data within this <see cref="T:System.Data.DataTable" />.</summary>
<returns>A <see cref="T:System.Data.DataTableReader" /> containing one result set, corresponding to the source <see cref="T:System.Data.DataTable" /> instance.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
The following console application creates a <xref:System.Data.DataTable> instance. The example then passes the filled <xref:System.Data.DataTable> to a procedure that calls the <xref:System.Data.DataTable.CreateDataReader%2A> method, which iterates through the results contained within the <xref:System.Data.DataTableReader>.
[!code-csharp[DataWorks DataTable.CreateDataReader#1](~/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DataTable.CreateDataReader/CS/source.cs#1)]
[!code-vb[DataWorks DataTable.CreateDataReader#1](~/samples/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DataTable.CreateDataReader/VB/source.vb#1)]
The example displays the following output in the console window:
`1 Mary`
`2 Andy`
`3 Peter`
`4 Russ`
]]></format>
</remarks>
<altmember cref="M:System.Data.DataSet.CreateDataReader" />
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
</Docs>
</Member>
<Member MemberName="CreateInstance">
<MemberSignature Language="C#" Value="protected virtual System.Data.DataTable CreateInstance ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance class System.Data.DataTable CreateInstance() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Data.DataTable.CreateInstance" />
<MemberSignature Language="VB.NET" Value="Protected Overridable Function CreateInstance () As DataTable" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; virtual System::Data::DataTable ^ CreateInstance();" />
<MemberSignature Language="F#" Value="abstract member CreateInstance : unit -&gt; System.Data.DataTable&#xA;override this.CreateInstance : unit -&gt; System.Data.DataTable" Usage="dataTable.CreateInstance " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Data.DataTable</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Creates a new instance of <see cref="T:System.Data.DataTable" />.</summary>
<returns>The new expression.</returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="DataSet">
<MemberSignature Language="C#" Value="public System.Data.DataSet DataSet { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Data.DataSet DataSet" />
<MemberSignature Language="DocId" Value="P:System.Data.DataTable.DataSet" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property DataSet As DataSet" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Data::DataSet ^ DataSet { System::Data::DataSet ^ get(); };" />
<MemberSignature Language="F#" Value="member this.DataSet : System.Data.DataSet" Usage="System.Data.DataTable.DataSet" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;netcore-2.2;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;xamarinmac-3.0;netcore-3.0;netstandard-2.1">
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-1.1">
<AttributeName>System.Data.DataSysDescription("DataTableDataSetDescr")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Data.DataSet</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the <see cref="T:System.Data.DataSet" /> to which this table belongs.</summary>
<value>The <see cref="T:System.Data.DataSet" /> to which this table belongs.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
If a control is data bound to a <xref:System.Data.DataTable>, and the table belongs to a <xref:System.Data.DataSet>, you can get to the <xref:System.Data.DataSet> through this property.
## Examples
The following example returns the parent <xref:System.Data.DataSet> of a given table through the <xref:System.Data.DataTable.DataSet%2A> property.
[!code-csharp[Classic WebData DataTable.DataSet Example#1](~/samples/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataTable.DataSet Example/CS/source.cs#1)]
[!code-vb[Classic WebData DataTable.DataSet Example#1](~/samples/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataTable.DataSet Example/VB/source.vb#1)]
]]></format>
</remarks>
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
</Docs>
</Member>
<Member MemberName="DefaultView">
<MemberSignature Language="C#" Value="public System.Data.DataView DefaultView { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Data.DataView DefaultView" />
<MemberSignature Language="DocId" Value="P:System.Data.DataTable.DefaultView" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property DefaultView As DataView" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Data::DataView ^ DefaultView { System::Data::DataView ^ get(); };" />
<MemberSignature Language="F#" Value="member this.DefaultView : System.Data.DataView" Usage="System.Data.DataTable.DefaultView" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-1.1">
<AttributeName>System.Data.DataSysDescription("DataTableDefaultViewDescr")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Data.DataView</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a customized view of the table that may include a filtered view, or a cursor position.</summary>
<value>The <see cref="T:System.Data.DataView" /> associated with the <see cref="T:System.Data.DataTable" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Data.DataTable.DefaultView%2A> property returns a <xref:System.Data.DataView> you can use to sort, filter, and search a <xref:System.Data.DataTable>.
## Examples
The following example sets a property of the <xref:System.Data.DataTable> object's <xref:System.Data.DataView> through the <xref:System.Data.DataTable.DefaultView%2A> property. The example also shows the binding of a <xref:System.Windows.Forms.DataGridView> control to a <xref:System.Data.DataTable> named "Suppliers" that includes a column named "CompanyName."
[!code-csharp[Classic WebData DataTable.DefaultView Example#1](~/samples/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataTable.DefaultView Example/CS/source.cs#1)]
[!code-vb[Classic WebData DataTable.DefaultView Example#1](~/samples/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataTable.DefaultView Example/VB/source.vb#1)]
]]></format>
</remarks>
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
</Docs>
</Member>
<Member MemberName="DisplayExpression">
<MemberSignature Language="C#" Value="public string DisplayExpression { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance string DisplayExpression" />
<MemberSignature Language="DocId" Value="P:System.Data.DataTable.DisplayExpression" />
<MemberSignature Language="VB.NET" Value="Public Property DisplayExpression As String" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::String ^ DisplayExpression { System::String ^ get(); void set(System::String ^ value); };" />
<MemberSignature Language="F#" Value="member this.DisplayExpression : string with get, set" Usage="System.Data.DataTable.DisplayExpression" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.ComponentModel.DefaultValue("")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-1.1">
<AttributeName>System.Data.DataSysDescription("DataTableDisplayExpressionDescr")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the expression that returns a value used to represent this table in the user interface. The <see langword="DisplayExpression" /> property lets you display the name of this table in a user interface.</summary>
<value>A display string.</value>
<remarks>To be added.</remarks>
<altmember cref="P:System.Data.DataColumn.Expression" />
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
</Docs>
</Member>
<Member MemberName="EndInit">
<MemberSignature Language="C#" Value="public virtual void EndInit ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void EndInit() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Data.DataTable.EndInit" />
<MemberSignature Language="VB.NET" Value="Public Overridable Sub EndInit ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual void EndInit();" />
<MemberSignature Language="F#" Value="abstract member EndInit : unit -&gt; unit&#xA;override this.EndInit : unit -&gt; unit" Usage="dataTable.EndInit " />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.ComponentModel.ISupportInitialize.EndInit</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Ends the initialization of a <see cref="T:System.Data.DataTable" /> that is used on a form or used by another component. The initialization occurs at run time.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The Visual Studio .NET design environment uses this method to end the initialization of a component that is used on a form or used by another component. The <xref:System.Data.DataTable.BeginInit%2A> method starts the initialization. Using the <xref:System.Data.DataTable.BeginInit%2A> and <xref:System.Data.DataTable.EndInit%2A> methods prevents the control from being used before it is fully initialized.
]]></format>
</remarks>
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
</Docs>
</Member>
<Member MemberName="EndLoadData">
<MemberSignature Language="C#" Value="public void EndLoadData ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void EndLoadData() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Data.DataTable.EndLoadData" />
<MemberSignature Language="VB.NET" Value="Public Sub EndLoadData ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; void EndLoadData();" />
<MemberSignature Language="F#" Value="member this.EndLoadData : unit -&gt; unit" Usage="dataTable.EndLoadData " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Turns on notifications, index maintenance, and constraints after loading data.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use <xref:System.Data.DataTable.EndLoadData%2A> in conjunction with <xref:System.Data.DataTable.LoadDataRow%2A> and <xref:System.Data.DataTable.BeginLoadData%2A>.
]]></format>
</remarks>
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
</Docs>
</Member>
<Member MemberName="ExtendedProperties">
<MemberSignature Language="C#" Value="public System.Data.PropertyCollection ExtendedProperties { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Data.PropertyCollection ExtendedProperties" />
<MemberSignature Language="DocId" Value="P:System.Data.DataTable.ExtendedProperties" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property ExtendedProperties As PropertyCollection" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Data::PropertyCollection ^ ExtendedProperties { System::Data::PropertyCollection ^ get(); };" />
<MemberSignature Language="F#" Value="member this.ExtendedProperties : System.Data.PropertyCollection" Usage="System.Data.DataTable.ExtendedProperties" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-1.1">
<AttributeName>System.Data.DataSysDescription("ExtendedPropertiesDescr")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Data.PropertyCollection</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the collection of customized user information.</summary>
<value>A <see cref="T:System.Data.PropertyCollection" /> that contains custom user information.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use the <xref:System.Data.DataTable.ExtendedProperties%2A> to add custom information to a <xref:System.Data.DataTable>. Add information with the `Add` method. Retrieve information with the `Item` method.
Extended properties must be of type <xref:System.String>. Properties that are not of type String are not persisted when the <xref:System.Data.DataTable> is written as XML.
## Examples
The following example adds a timestamp value to the <xref:System.Data.DataTable> through the <xref:System.Data.DataTable.ExtendedProperties%2A> property.
[!code-csharp[Classic WebData DataTable.ExtendedProperties Example#1](~/samples/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataTable.ExtendedProperties Example/CS/source.cs#1)]
[!code-vb[Classic WebData DataTable.ExtendedProperties Example#1](~/samples/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataTable.ExtendedProperties Example/VB/source.vb#1)]
]]></format>
</remarks>
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
</Docs>
</Member>
<Member MemberName="fInitInProgress">
<MemberSignature Language="C#" Value="protected internal bool fInitInProgress;" />
<MemberSignature Language="ILAsm" Value=".field familyorassembly bool fInitInProgress" />
<MemberSignature Language="DocId" Value="F:System.Data.DataTable.fInitInProgress" />
<MemberSignature Language="VB.NET" Value="Protected Friend fInitInProgress As Boolean " />
<MemberSignature Language="C++ CLI" Value="protected public: bool fInitInProgress;" />
<MemberSignature Language="F#" Value="val mutable fInitInProgress : bool" Usage="System.Data.DataTable.fInitInProgress" />
<MemberType>Field</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Checks whether initialization is in progress. The initialization occurs at run time.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<MemberGroup MemberName="GetChanges">
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Gets a copy of the <see cref="T:System.Data.DataTable" /> containing all changes made to it since it was last loaded, or since <see cref="M:System.Data.DataTable.AcceptChanges" /> was called.</summary>
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
<related type="Article" href="https://msdn.microsoft.com/library/62f404a5-13ea-4b93-a29f-55b74a16c9d3">Working with DataTable Events</related>
</Docs>
</MemberGroup>
<Member MemberName="GetChanges">
<MemberSignature Language="C#" Value="public System.Data.DataTable GetChanges ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.Data.DataTable GetChanges() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Data.DataTable.GetChanges" />
<MemberSignature Language="VB.NET" Value="Public Function GetChanges () As DataTable" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; System::Data::DataTable ^ GetChanges();" />
<MemberSignature Language="F#" Value="member this.GetChanges : unit -&gt; System.Data.DataTable" Usage="dataTable.GetChanges " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Data.DataTable</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Gets a copy of the <see cref="T:System.Data.DataTable" /> that contains all changes made to it since it was loaded or <see cref="M:System.Data.DataTable.AcceptChanges" /> was last called.</summary>
<returns>A copy of the changes from this <see cref="T:System.Data.DataTable" />, or <see langword="null" /> if no changes are found.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Creates a new <xref:System.Data.DataSet> containing a copy of all rows in the original <xref:System.Data.DataSet> that have pending changes. Relationship constraints can cause additional unchanged rows to be added to the new <xref:System.Data.DataSet> if the unchanged rows contain primary keys corresponding to foreign keys in the changed rows. The method returns `null` (`Nothing` in Visual Basic) if there are no rows in the original <xref:System.Data.DataSet> with pending changes.
## Examples
[!code-csharp[Classic WebData DataTable.GetChanges Example#1](~/samples/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataTable.GetChanges Example/CS/source.cs#1)]
[!code-vb[Classic WebData DataTable.GetChanges Example#1](~/samples/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataTable.GetChanges Example/VB/source.vb#1)]
]]></format>
</remarks>
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
<related type="Article" href="https://msdn.microsoft.com/library/62f404a5-13ea-4b93-a29f-55b74a16c9d3">Working with DataTable Events</related>
</Docs>
</Member>
<Member MemberName="GetChanges">
<MemberSignature Language="C#" Value="public System.Data.DataTable GetChanges (System.Data.DataRowState rowStates);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.Data.DataTable GetChanges(valuetype System.Data.DataRowState rowStates) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Data.DataTable.GetChanges(System.Data.DataRowState)" />
<MemberSignature Language="VB.NET" Value="Public Function GetChanges (rowStates As DataRowState) As DataTable" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; System::Data::DataTable ^ GetChanges(System::Data::DataRowState rowStates);" />
<MemberSignature Language="F#" Value="member this.GetChanges : System.Data.DataRowState -&gt; System.Data.DataTable" Usage="dataTable.GetChanges rowStates" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Data.DataTable</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="rowStates" Type="System.Data.DataRowState" Index="0" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1" />
</Parameters>
<Docs>
<param name="rowStates">One of the <see cref="T:System.Data.DataRowState" /> values.</param>
<summary>Gets a copy of the <see cref="T:System.Data.DataTable" /> containing all changes made to it since it was last loaded, or since <see cref="M:System.Data.DataTable.AcceptChanges" /> was called, filtered by <see cref="T:System.Data.DataRowState" />.</summary>
<returns>A filtered copy of the <see cref="T:System.Data.DataTable" /> that can have actions performed on it, and later be merged back in the <see cref="T:System.Data.DataTable" /> using <see cref="M:System.Data.DataSet.Merge(System.Data.DataSet)" />. If no rows of the desired <see cref="T:System.Data.DataRowState" /> are found, the method returns <see langword="null" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Data.DataTable.GetChanges%2A> method is used to produce a second <xref:System.Data.DataTable> object that contains only the changes introduced into the original. Use the `rowStates` argument to specify the type of changes the new object should include.
Relationship constraints may cause unchanged parent rows to be included.
## Examples
[!code-csharp[Classic WebData DataTable.GetChanges1 Example#1](~/samples/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataTable.GetChanges1 Example/CS/source.cs#1)]
[!code-vb[Classic WebData DataTable.GetChanges1 Example#1](~/samples/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataTable.GetChanges1 Example/VB/source.vb#1)]
]]></format>
</remarks>
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
<related type="Article" href="https://msdn.microsoft.com/library/62f404a5-13ea-4b93-a29f-55b74a16c9d3">Working with DataTable Events</related>
</Docs>
</Member>
<Member MemberName="GetDataTableSchema">
<MemberSignature Language="C#" Value="public static System.Xml.Schema.XmlSchemaComplexType GetDataTableSchema (System.Xml.Schema.XmlSchemaSet schemaSet);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Xml.Schema.XmlSchemaComplexType GetDataTableSchema(class System.Xml.Schema.XmlSchemaSet schemaSet) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Data.DataTable.GetDataTableSchema(System.Xml.Schema.XmlSchemaSet)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function GetDataTableSchema (schemaSet As XmlSchemaSet) As XmlSchemaComplexType" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static System::Xml::Schema::XmlSchemaComplexType ^ GetDataTableSchema(System::Xml::Schema::XmlSchemaSet ^ schemaSet);" />
<MemberSignature Language="F#" Value="static member GetDataTableSchema : System.Xml.Schema.XmlSchemaSet -&gt; System.Xml.Schema.XmlSchemaComplexType" Usage="System.Data.DataTable.GetDataTableSchema schemaSet" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Xml.Schema.XmlSchemaComplexType</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="schemaSet" Type="System.Xml.Schema.XmlSchemaSet" Index="0" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1" />
</Parameters>
<Docs>
<param name="schemaSet">An <see cref="T:System.Xml.Schema.XmlSchemaSet" /> instance.</param>
<summary>This method returns an <see cref="T:System.Xml.Schema.XmlSchemaSet" /> instance containing the Web Services Description Language (WSDL) that describes the <see cref="T:System.Data.DataTable" /> for Web Services.</summary>
<returns>The <see cref="T:System.Xml.Schema.XmlSchemaSet" /> instance.</returns>
<remarks>To be added.</remarks>
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
</Docs>
</Member>
<Member MemberName="GetErrors">
<MemberSignature Language="C#" Value="public System.Data.DataRow[] GetErrors ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.Data.DataRow[] GetErrors() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Data.DataTable.GetErrors" />
<MemberSignature Language="VB.NET" Value="Public Function GetErrors () As DataRow()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; cli::array &lt;System::Data::DataRow ^&gt; ^ GetErrors();" />
<MemberSignature Language="F#" Value="member this.GetErrors : unit -&gt; System.Data.DataRow[]" Usage="dataTable.GetErrors " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Data.DataRow[]</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Gets an array of <see cref="T:System.Data.DataRow" /> objects that contain errors.</summary>
<returns>An array of <see cref="T:System.Data.DataRow" /> objects that have errors.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Returns the list of <xref:System.Data.DataRow> objects that have <xref:System.Data.DataRow.RowError%2A> set. For example, errors can occur when calling <xref:System.Data.Common.DataAdapter.Update%2A> with <xref:System.Data.Common.DataAdapter.ContinueUpdateOnError%2A> set to `true`. Do not invoke <xref:System.Data.DataTable.AcceptChanges%2A> on the <xref:System.Data.DataTable> until you resolve all errors and resubmit the <xref:System.Data.DataSet> for updating.
## Examples
The following example uses the <xref:System.Data.DataTable.GetErrors%2A> method to return an array of <xref:System.Data.DataRow> objects that have errors.
[!code-csharp[Classic WebData DataTable.GetErrors Example#1](~/samples/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataTable.GetErrors Example/CS/source.cs#1)]
[!code-vb[Classic WebData DataTable.GetErrors Example#1](~/samples/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataTable.GetErrors Example/VB/source.vb#1)]
]]></format>
</remarks>
<altmember cref="P:System.Data.DataTable.HasErrors" />
<altmember cref="P:System.Data.DataRow.RowError" />
<altmember cref="M:System.Data.DataRow.SetColumnError(System.Int32,System.String)" />
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">DataTables (ADO.NET)</related>
</Docs>
</Member>
<Member MemberName="GetObjectData">
<MemberSignature Language="C#" Value="public virtual void GetObjectData (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void GetObjectData(class System.Runtime.Serialization.SerializationInfo info, valuetype System.Runtime.Serialization.StreamingContext context) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Data.DataTable.GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)" />
<MemberSignature Language="VB.NET" Value="Public Overridable Sub GetObjectData (info As SerializationInfo, context As StreamingContext)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual void GetObjectData(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);" />
<MemberSignature Language="F#" Value="abstract member GetObjectData : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -&gt; unit&#xA;override this.GetObjectData : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -&gt; unit" Usage="dataTable.GetObjectData (info, context)" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="info" Type="System.Runtime.Serialization.SerializationInfo" Index="0" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1" />
<Parameter Name="context" Type="System.Runtime.Serialization.StreamingContext" Index="1" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1" />
</Parameters>
<Docs>
<param name="info">A <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object that holds the serialized data associated with the <see cref="T:System.Data.DataTable" />.</param>
<param name="context">A <see cref="T:System.Runtime.Serialization.StreamingContext" /> object that contains the source and destination of the serialized stream associated with the <see cref="T:System.Data.DataTable" />.</param>
<summary>Populates a serialization information object with the data needed to serialize the <see cref="T:System.Data.DataTable" />.</summary>
<remarks>To be added.</remarks>
<exception cref="T:System.ArgumentNullException">The <paramref name="info" /> parameter is a null reference (<see langword="Nothing" /> in Visual Basic).</exception>
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
</Docs>
</Member>
<Member MemberName="GetRowType">
<MemberSignature Language="C#" Value="protected virtual Type GetRowType ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance class System.Type GetRowType() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Data.DataTable.GetRowType" />
<MemberSignature Language="VB.NET" Value="Protected Overridable Function GetRowType () As Type" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; virtual Type ^ GetRowType();" />
<MemberSignature Language="F#" Value="abstract member GetRowType : unit -&gt; Type&#xA;override this.GetRowType : unit -&gt; Type" Usage="dataTable.GetRowType " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Type</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Gets the row type.</summary>
<returns>The type of the <see cref="T:System.Data.DataRow" />.</returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="GetSchema">
<MemberSignature Language="C#" Value="protected virtual System.Xml.Schema.XmlSchema GetSchema ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance class System.Xml.Schema.XmlSchema GetSchema() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Data.DataTable.GetSchema" />
<MemberSignature Language="VB.NET" Value="Protected Overridable Function GetSchema () As XmlSchema" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; virtual System::Xml::Schema::XmlSchema ^ GetSchema();" />
<MemberSignature Language="F#" Value="abstract member GetSchema : unit -&gt; System.Xml.Schema.XmlSchema&#xA;override this.GetSchema : unit -&gt; System.Xml.Schema.XmlSchema" Usage="dataTable.GetSchema " />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.Xml.Serialization.IXmlSerializable.GetSchema</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Xml.Schema.XmlSchema</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>For a description of this member, see <see cref="M:System.Xml.Serialization.IXmlSerializable.GetSchema" />.</summary>
<returns>An <see cref="T:System.Xml.Schema.XmlSchema" /> that describes the XML representation of the object that is produced by the <see cref="M:System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter)" /> method and consumed by the <see cref="M:System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader)" /> method.</returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="HasErrors">
<MemberSignature Language="C#" Value="public bool HasErrors { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool HasErrors" />
<MemberSignature Language="DocId" Value="P:System.Data.DataTable.HasErrors" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property HasErrors As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property bool HasErrors { bool get(); };" />
<MemberSignature Language="F#" Value="member this.HasErrors : bool" Usage="System.Data.DataTable.HasErrors" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-2.0;netcore-2.1;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-1.1">
<AttributeName>System.Data.DataSysDescription("DataTableHasErrorsDescr")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a value indicating whether there are errors in any of the rows in any of the tables of the <see cref="T:System.Data.DataSet" /> to which the table belongs.</summary>
<value>
<see langword="true" /> if errors exist; otherwise <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
As users work on a set of data contained in a <xref:System.Data.DataTable>, you can mark each change with an error if the change causes some validation failure. You can mark an entire <xref:System.Data.DataRow> with an error message using the <xref:System.Data.DataRow.RowError%2A> property. You can also set errors on each column of the row with the <xref:System.Data.DataRow.SetColumnError%2A> method.
Before updating a data source with a <xref:System.Data.DataSet>, it's recommended that you first invoke the <xref:System.Data.DataSet.GetChanges%2A> method on the target <xref:System.Data.DataSet>. The method results in a <xref:System.Data.DataSet> that contains only the changes made to the original. Before sending the <xref:System.Data.DataSet> to the data source for updating, check the <xref:System.Data.DataTable.HasErrors%2A> property of each table to see if any errors have been attached to the rows or columns in the rows.
After reconciling each error, clear the errors with the <xref:System.Data.DataRow.ClearErrors%2A> method of the `DataRow`.
## Examples
The following example uses the <xref:System.Data.DataTable.HasErrors%2A> property to check if a table contains errors.
[!code-csharp[Classic WebData DataTable.HasErrors Example#1](~/samples/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataTable.HasErrors Example/CS/source.cs#1)]
[!code-vb[Classic WebData DataTable.HasErrors Example#1](~/samples/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataTable.HasErrors Example/VB/source.vb#1)]
]]></format>
</remarks>
<altmember cref="M:System.Data.DataTable.GetErrors" />
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
</Docs>
</Member>
<Member MemberName="ImportRow">
<MemberSignature Language="C#" Value="public void ImportRow (System.Data.DataRow row);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void ImportRow(class System.Data.DataRow row) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Data.DataTable.ImportRow(System.Data.DataRow)" />
<MemberSignature Language="VB.NET" Value="Public Sub ImportRow (row As DataRow)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; void ImportRow(System::Data::DataRow ^ row);" />
<MemberSignature Language="F#" Value="member this.ImportRow : System.Data.DataRow -&gt; unit" Usage="dataTable.ImportRow row" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="row" Type="System.Data.DataRow" Index="0" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1" />
</Parameters>
<Docs>
<param name="row">The <see cref="T:System.Data.DataRow" /> to be imported.</param>
<summary>Copies a <see cref="T:System.Data.DataRow" /> into a <see cref="T:System.Data.DataTable" />, preserving any property settings, as well as original and current values.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Calling <xref:System.Data.DataTable.NewRow%2A> adds a row to the table using the existing table schema, but with default values for the row, and sets the <xref:System.Data.DataRowState> to `Detached`. Calling <xref:System.Data.DataTable.ImportRow%2A> preserves the existing <xref:System.Data.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 <xref:System.Data.DataRowCollection> and <xref:System.Data.DataTable.Rows%2A> for more information.
]]></format>
</remarks>
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
<related type="Article" href="https://msdn.microsoft.com/library/5cb86d48-a987-4af4-80e0-8cc2c8373d62">Manipulating Data in a DataTable (ADO.NET)</related>
</Docs>
</Member>
<Member MemberName="Initialized">
<MemberSignature Language="C#" Value="public event EventHandler Initialized;" />
<MemberSignature Language="ILAsm" Value=".event class System.EventHandler Initialized" />
<MemberSignature Language="DocId" Value="E:System.Data.DataTable.Initialized" />
<MemberSignature Language="VB.NET" Value="Public Custom Event Initialized As EventHandler " />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual event EventHandler ^ Initialized;" />
<MemberSignature Language="F#" Value="member this.Initialized : EventHandler " Usage="member this.Initialized : System.EventHandler " />
<MemberType>Event</MemberType>
<Implements>
<InterfaceMember>E:System.ComponentModel.ISupportInitializeNotification.Initialized</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.EventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs after the <see cref="T:System.Data.DataTable" /> is initialized.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
For more information, see <xref:System.Data.DataTable.IsInitialized%2A>.
]]></format>
</remarks>
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
<related type="Article" href="https://msdn.microsoft.com/library/62f404a5-13ea-4b93-a29f-55b74a16c9d3">Working with DataTable Events</related>
</Docs>
</Member>
<Member MemberName="IsInitialized">
<MemberSignature Language="C#" Value="public bool IsInitialized { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool IsInitialized" />
<MemberSignature Language="DocId" Value="P:System.Data.DataTable.IsInitialized" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property IsInitialized As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property bool IsInitialized { bool get(); };" />
<MemberSignature Language="F#" Value="member this.IsInitialized : bool" Usage="System.Data.DataTable.IsInitialized" />
<MemberType>Property</MemberType>
<Implements>
<InterfaceMember>P:System.ComponentModel.ISupportInitializeNotification.IsInitialized</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netcore-2.0;netcore-2.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a value that indicates whether the <see cref="T:System.Data.DataTable" /> is initialized.</summary>
<value>
<see langword="true" /> to indicate the component has completed initialization; otherwise <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Returns the status of the <xref:System.Data.DataTable> while it's being constructed, for instance by Visual Studio. The <xref:System.Data.DataTable.BeginInit%2A> method sets it to `false` and <xref:System.Data.DataTable.EndInit%2A> method sets it to `true`.
]]></format>
</remarks>
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
<related type="Article" href="https://msdn.microsoft.com/library/62f404a5-13ea-4b93-a29f-55b74a16c9d3">Working with DataTable Events</related>
</Docs>
</Member>
<MemberGroup MemberName="Load">
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Fills a <see cref="T:System.Data.DataTable" /> with values from a data source using the supplied <see cref="T:System.Data.IDataReader" />. If the <see langword="DataTable" /> already contains rows, the incoming data from the data source is merged with the existing rows.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The `Load` method can be used in several common scenarios, all centered around getting data from a specified data source and adding it to the current data container (in this case, a `DataTable`). These scenarios describe standard usage for a `DataTable`, describing its update and merge behavior.
A `DataTable` synchronizes or updates with a single primary data source. The `DataTable` tracks changes, allowing synchronization with the primary data source. In addition, a `DataTable` can accept incremental data from one or more secondary data sources. The `DataTable` isn't responsible for tracking changes in order to allow synchronization with the secondary data source.
Given these two hypothetical data sources, a user is likely to require one of the following behaviors:
- Initialize `DataTable` from a primary data source. In this scenario, the user wants to initialize an empty `DataTable` with values from the primary data source. Later the user intends to propagate changes back to the primary data source.
- Preserve changes and re-synchronize from the primary data source. In this scenario, the user wants to take the `DataTable` filled in the previous scenario and perform an incremental synchronization with the primary data source, preserving modifications made in the `DataTable`.
- Incremental data feed from secondary data sources. In this scenario, the user wants to merge changes from one or more secondary data sources, and propagate those changes back to the primary data source.
The `Load` method makes all these scenarios possible. All but one of the overloads for this method allows you to specify a load option parameter, indicating how rows already in a <xref:System.Data.DataTable> combine with rows being loaded. (The overload that doesn't allow you to specify the behavior uses the default load option.) The following table describes the three load options provided by the <xref:System.Data.LoadOption> enumeration. In each case, the description indicates the behavior when the primary key of a row in the incoming data matches the primary key of an existing row.
|Load Option|Description|
|-----------------|-----------------|
|`PreserveChanges` (default)|Updates the original version of the row with the value of the incoming row.|
|`OverwriteChanges`|Updates the current and original versions of the row with the value of the incoming row.|
|`Upsert`|Updates the current version of the row with the value of the incoming row.|
In general, the `PreserveChanges` and `OverwriteChanges` options are intended for scenarios in which the user needs to synchronize the `DataSet` and its changes with the primary data source. The `Upsert` option facilitates aggregating changes from one or more secondary data sources.
## Examples
The following example demonstrates several of the issues involved with calling the <xref:System.Data.DataTable.Load%2A> method. First, the example focuses on schema issues, including inferring a schema from the loaded <xref:System.Data.IDataReader>, and then handling incompatible schemas, and schemas with missing or additional columns. The example then focuses on data issues, including handling the various loading options.
> [!NOTE]
> This example shows how to use one of the overloaded versions of `Load`. For other examples that might be available, see the individual overload topics.
[!code-csharp[DataWorks DataTableLoad#1](~/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DataTableLoad/CS/source.cs#1)]
[!code-vb[DataWorks DataTableLoad#1](~/samples/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DataTableLoad/VB/source.vb#1)]
]]></format>
</remarks>
<altmember cref="Overload:System.Data.DataSet.Load" />
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
</Docs>
</MemberGroup>
<Member MemberName="Load">
<MemberSignature Language="C#" Value="public void Load (System.Data.IDataReader reader);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Load(class System.Data.IDataReader reader) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Data.DataTable.Load(System.Data.IDataReader)" />
<MemberSignature Language="VB.NET" Value="Public Sub Load (reader As IDataReader)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; void Load(System::Data::IDataReader ^ reader);" />
<MemberSignature Language="F#" Value="member this.Load : System.Data.IDataReader -&gt; unit" Usage="dataTable.Load reader" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="reader" Type="System.Data.IDataReader" Index="0" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1" />
</Parameters>
<Docs>
<param name="reader">An <see cref="T:System.Data.IDataReader" /> that provides a result set.</param>
<summary>Fills a <see cref="T:System.Data.DataTable" /> with values from a data source using the supplied <see cref="T:System.Data.IDataReader" />. If the <see cref="T:System.Data.DataTable" /> already contains rows, the incoming data from the data source is merged with the existing rows.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Data.DataTable.Load%2A> method consumes the first result set from the loaded <xref:System.Data.IDataReader>, and after successful completion, sets the reader's position to the next result set, if any. When converting data, the `Load` method uses the same conversion rules as the <xref:System.Data.Common.DbDataAdapter.Fill%2A?displayProperty=nameWithType> method.
The <xref:System.Data.DataTable.Load%2A> method must take into account three specific issues when loading the data from an <xref:System.Data.IDataReader> instance: schema, data, and event operations. When working with the schema, the <xref:System.Data.DataTable.Load%2A> method may encounter conditions as described in the following table. The schema operations take place for all imported result sets, even those containing no data.
|Condition|Behavior|
|---------------|--------------|
|The <xref:System.Data.DataTable> has no schema.|The <xref:System.Data.DataTable.Load%2A> method infers the schema based on the result set from the imported <xref:System.Data.IDataReader>.|
|The <xref:System.Data.DataTable> has a schema, but it is incompatible with the loaded schema.|The <xref:System.Data.DataTable.Load%2A> method throws an exception corresponding to the particular error that occurs when attempting to load data into the incompatible schema.|
|The schemas are compatible, but the loaded result set schema contains columns that do not exist in the <xref:System.Data.DataTable>.|The <xref:System.Data.DataTable.Load%2A> method adds the extra columns to `DataTable`'s schema. The method throws an exception if corresponding columns in the <xref:System.Data.DataTable> and the loaded result set are not value compatible. The method also retrieves constraint information from the result set for all added columns. Except for the case of Primary Key constraint, this constraint information is used only if the current <xref:System.Data.DataTable> does not contain any columns at the start of the load operation.|
|The schemas are compatible, but the loaded result set schema contains fewer columns than does the `DataTable`.|If a missing column has a default value defined or the column's data type is nullable, the <xref:System.Data.DataTable.Load%2A> method allows the rows to be added, substituting the default or `null` value for the missing column. If no default value or `null` can be used, then the `Load` method throws an exception. If no specific default value has been supplied, the `Load` method uses the `null` value as the implied default value.|
Before considering the behavior of the `Load` method in terms of data operations, consider that each row within a <xref:System.Data.DataTable> maintains both the current value and the original value for each column. These values may be equivalent, or may be different if the data in the row has been changed since filling the `DataTable`. For more information, see [Row States and Row Versions](~/docs/framework/data/adonet/dataset-datatable-dataview/row-states-and-row-versions.md).
This version of the `Load` method attempts to preserve the current values in each row, leaving the original value intact. (If you want finer control over the behavior of incoming data, see <xref:System.Data.DataTable.Load%2A?displayProperty=nameWithType>.) If the existing row and the incoming row contain corresponding primary key values, the row is processed using its current row state value, otherwise it's treated as a new row.
In terms of event operations, the <xref:System.Data.DataTable.RowChanging> event occurs before each row is changed, and the <xref:System.Data.DataTable.RowChanged> event occurs after each row has been changed. In each case, the <xref:System.Data.DataRowChangeEventArgs.Action%2A> property of the <xref:System.Data.DataRowChangeEventArgs> instance passed to the event handler contains information about the particular action associated with the event. This action value depends on the state of the row before the load operation. In each case, both events occur, and the action is the same for each. The action may be applied to either the current or original version of each row, or both, depending on the current row state.
The following table displays behavior for the `Load` method. The final row (labeled "(Not present)") describes the behavior for incoming rows that don't match any existing row. Each cell in this table describes the current and original value for a field within a row, along with the <xref:System.Data.DataRowState> for the value after the `Load` method has completed. In this case, the method doesn't allow you to indicate the load option, and uses the default, `PreserveChanges`.
|Existing DataRowState|Values after `Load` method, and event action|
|---------------------------|--------------------------------------------------|
|Added|Current = \<Existing><br /><br /> Original = \<Incoming><br /><br /> State = \<Modified><br /><br /> RowAction = ChangeOriginal|
|Modified|Current = \<Existing><br /><br /> Original = \<Incoming><br /><br /> State = \<Modified><br /><br /> RowAction = ChangeOriginal|
|Deleted|Current = \<Not available><br /><br /> Original = \<Incoming><br /><br /> State = \<Deleted><br /><br /> RowAction = ChangeOriginal|
|Unchanged|Current = \<Incoming><br /><br /> Original = \<Incoming><br /><br /> State = \<Unchanged><br /><br /> RowAction = ChangeCurrentAndOriginal|
|(Not present)|Current = \<Incoming><br /><br /> Original = \<Incoming><br /><br /> State = \<Unchanged><br /><br /> RowAction = ChangeCurrentAndOriginal|
Values in a <xref:System.Data.DataColumn> can be constrained through use of properties such as <xref:System.Data.DataColumn.ReadOnly%2A> and <xref:System.Data.DataColumn.AutoIncrement%2A>. The `Load` method handles such columns in a manner that is consistent with the behavior defined by the column's properties. The read only constraint on a <xref:System.Data.DataColumn> is applicable only for changes that occur in memory. The `Load` method's overwrites the read-only column values, if needed.
To determine which version of the primary key field to use for comparing the current row with an incoming row, the `Load` method uses the original version of the primary key value within a row, if it exists. Otherwise, the `Load` method uses the current version of the primary key field.
## Examples
The following example demonstrates several of the issues involved with calling the <xref:System.Data.DataTable.Load%2A> method. First, the example focuses on schema issues, including inferring a schema from the loaded <xref:System.Data.IDataReader>, and then handling incompatible schemas, and schemas with missing or additional columns. The example then calls the `Load` method, displaying the data both before and after the load operation.
[!code-csharp[DataWorks DataTableLoad.IDataReader#1](~/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DataTableLoad.IDataReader/CS/source.cs#1)]
[!code-vb[DataWorks DataTableLoad.IDataReader#1](~/samples/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DataTableLoad.IDataReader/VB/source.vb#1)]
]]></format>
</remarks>
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
<related type="Article" href="https://msdn.microsoft.com/library/62f404a5-13ea-4b93-a29f-55b74a16c9d3">Working with DataTable Events</related>
</Docs>
</Member>
<Member MemberName="Load">
<MemberSignature Language="C#" Value="public void Load (System.Data.IDataReader reader, System.Data.LoadOption loadOption);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Load(class System.Data.IDataReader reader, valuetype System.Data.LoadOption loadOption) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Data.DataTable.Load(System.Data.IDataReader,System.Data.LoadOption)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; void Load(System::Data::IDataReader ^ reader, System::Data::LoadOption loadOption);" />
<MemberSignature Language="F#" Value="member this.Load : System.Data.IDataReader * System.Data.LoadOption -&gt; unit" Usage="dataTable.Load (reader, loadOption)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="reader" Type="System.Data.IDataReader" Index="0" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1" />
<Parameter Name="loadOption" Type="System.Data.LoadOption" Index="1" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1" />
</Parameters>
<Docs>
<param name="reader">An <see cref="T:System.Data.IDataReader" /> that provides one or more result sets.</param>
<param name="loadOption">A value from the <see cref="T:System.Data.LoadOption" /> enumeration that indicates how rows already in the <see cref="T:System.Data.DataTable" /> are combined with incoming rows that share the same primary key.</param>
<summary>Fills a <see cref="T:System.Data.DataTable" /> with values from a data source using the supplied <see cref="T:System.Data.IDataReader" />. If the <see langword="DataTable" /> already contains rows, the incoming data from the data source is merged with the existing rows according to the value of the <paramref name="loadOption" /> parameter.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The `Load` method consumes the first result set from the loaded <xref:System.Data.IDataReader>, and after successful completion, sets the reader's position to the next result set, if any. When converting data, the `Load` method uses the same conversion rules as the <xref:System.Data.Common.DbDataAdapter.Fill%2A> method.
The `Load` method must take into account three specific issues when loading the data from an <xref:System.Data.IDataReader> instance: schema, data, and event operations. When working with the schema, the `Load` method may encounter conditions as described in the following table. The schema operations take place for all imported result sets, even those containing no data.
|Condition|Behavior|
|---------------|--------------|
|The <xref:System.Data.DataTable> has no schema.|The `Load` method infers the schema based on the result set from the imported <xref:System.Data.IDataReader>.|
|The <xref:System.Data.DataTable> has a schema, but it is incompatible with the loaded schema.|The `Load` method throws an exception corresponding to the particular error that occurs when attempting to load data into the incompatible schema.|
|The schemas are compatible, but the loaded result set schema contains columns that don't exist in the `DataTable`.|The `Load` method adds the extra columns to `DataTable`'s schema. The method throws an exception if corresponding columns in the <xref:System.Data.DataTable> and the loaded result set are not value compatible. The method also retrieves constraint information from the result set for all added columns. Except for the case of Primary Key constraint, this constraint information is used only if the current <xref:System.Data.DataTable> does not contain any columns at the start of the load operation.|
|The schemas are compatible, but the loaded result set schema contains fewer columns than does the `DataTable`.|If a missing column has a default value defined or the column's data type is nullable, the `Load` method allows the rows to be added, substituting the default or null value for the missing column. If no default value or null can be used, then the `Load` method throws an exception. If no specific default value has been supplied, the `Load` method uses the null value as the implied default value.|
Before considering the behavior of the `Load` method in terms of data operations, consider that each row within a <xref:System.Data.DataTable> maintains both the current value and the original value for each column. These values may be equivalent, or may be different if the data in the row has been changed since filling the `DataTable`. See [Row States and Row Versions](~/docs/framework/data/adonet/dataset-datatable-dataview/row-states-and-row-versions.md) for more information.
In this method call, the specified <xref:System.Data.LoadOption> parameter influences the processing of the incoming data. How should the Load method handle loading rows that have the same primary key as existing rows? Should it modify current values, original values, or both? These issues, and more, are controlled by the `loadOption` parameter.
If the existing row and the incoming row contain corresponding primary key values, the row is processed using its current row state value, otherwise it's treated as a new row.
In terms of event operations, the <xref:System.Data.DataTable.RowChanging> event occurs before each row is changed, and the <xref:System.Data.DataTable.RowChanged> event occurs after each row has been changed. In each case, the <xref:System.Data.DataRowChangeEventArgs.Action%2A> property of the <xref:System.Data.DataRowChangeEventArgs> instance passed to the event handler contains information about the particular action associated with the event. This action value varies, depending on the state of the row before the load operation. In each case, both events occur, and the action is the same for each. The action may be applied to either the current or original version of each row, or both, depending on the current row state.
The following table displays behavior for the Load method when called with each of the `LoadOption` values, and also shows how the values interact with the row state for the row being loaded. The final row (labeled "(Not present)") describes the behavior for incoming rows that don't match any existing row. Each cell in this table describes the current and original value for a field within a row, along with the <xref:System.Data.DataRowState> for the value after the `Load` method has completed.
|Existing DataRowState|Upsert|OverwriteChanges|PreserveChanges (Default behavior)|
|---------------------------|------------|----------------------|------------------------------------------|
|Added|Current = \<Incoming><br /><br /> Original = -\<Not available><br /><br /> State = \<Added><br /><br /> RowAction = Change|Current = \<Incoming><br /><br /> Original = \<Incoming><br /><br /> State = \<Unchanged><br /><br /> RowAction = ChangeCurrentAndOriginal|Current = \<Existing><br /><br /> Original = \<Incoming><br /><br /> State = \<Modified><br /><br /> RowAction = ChangeOriginal|
|Modified|Current = \<Incoming><br /><br /> Original = \<Existing><br /><br /> State = \<Modified><br /><br /> RowAction = Change|Current = \<Incoming><br /><br /> Original = \<Incoming><br /><br /> State = \<Unchanged><br /><br /> RowAction = ChangeCurrentAndOriginal|Current = \<Existing><br /><br /> Original = \<Incoming><br /><br /> State = \<Modified><br /><br /> RowAction =ChangeOriginal|
|Deleted|(Load does not affect deleted rows)<br /><br /> Current = ---<br /><br /> Original = \<Existing><br /><br /> State = \<Deleted><br /><br /> (New row is added with the following characteristics)<br /><br /> Current = \<Incoming><br /><br /> Original = \<Not available><br /><br /> State = \<Added><br /><br /> RowAction = Add|Undo delete and<br /><br /> Current = \<Incoming><br /><br /> Original = \<Incoming><br /><br /> State = \<Unchanged><br /><br /> RowAction = ChangeCurrentAndOriginal|Current = \<Not available><br /><br /> Original = \<Incoming><br /><br /> State = \<Deleted><br /><br /> RowAction = ChangeOriginal|
|Unchanged|Current = \<Incoming><br /><br /> Original = \<Existing><br /><br /> If new value is the same as the existing value then<br /><br /> State = \<Unchanged><br /><br /> RowAction = Nothing<br /><br /> Else<br /><br /> State = \<Modified><br /><br /> RowAction = Change|Current = \<Incoming><br /><br /> Original = \<Incoming><br /><br /> State = \<Unchanged><br /><br /> RowAction = ChangeCurrentAndOriginal|Current = \<Incoming><br /><br /> Original = \<Incoming><br /><br /> State = \<Unchanged><br /><br /> RowAction = ChangeCurrentAndOriginal|
Not present)|Current = \<Incoming><br /><br /> Original = \<Not available><br /><br /> State = \<Added><br /><br /> RowAction = Add|Current = \<Incoming><br /><br /> Original = \<Incoming><br /><br /> State = \<Unchanged><br /><br /> RowAction = ChangeCurrentAndOriginal|Current = \<Incoming><br /><br /> Original = \<Incoming><br /><br /> State = \<Unchanged><br /><br /> RowAction = ChangeCurrentAndOriginal|
Values in a <xref:System.Data.DataColumn> can be constrained through use of properties such as <xref:System.Data.DataColumn.ReadOnly%2A> and <xref:System.Data.DataColumn.AutoIncrement%2A>. The `Load` method handles such columns in a manner that is consistent with the behavior defined by the column's properties. The read only constraint on a <xref:System.Data.DataColumn> is applicable only for changes that occur in memory. The `Load` method's overwrites the read-only column values, if needed.
If you specify the OverwriteChanges or PreserveChanges options when calling the `Load` method, then the assumption is made that the incoming data is coming from the `DataTable`'s primary data source, and the DataTable tracks changes and can propagate the changes back to the data source. If you select the Upsert option, it is assumed that the data is coming from one of a secondary data source, such as data provided by a middle-tier component, perhaps altered by a user. In this case, the assumption is that the intent is to aggregate data from one or more data sources in the `DataTable`, and then perhaps propagate the data back to the primary data source. The <xref:System.Data.LoadOption> parameter is used for determining the specific version of the row that is to be used for primary key comparison. The table below provides the details.
|Load option|DataRow version used for primary key comparison|
|-----------------|-----------------------------------------------------|
|`OverwriteChanges`|Original version, if it exists, otherwise Current version|
|`PreserveChanges`|Original version, if it exists, otherwise Current version|
|`Upsert`|Current version, if it exists, otherwise Original version|
## Examples
The following example demonstrates several of the issues involved with calling the <xref:System.Data.DataTable.Load%2A> method. First, the example focuses on schema issues, including inferring a schema from the loaded <xref:System.Data.IDataReader>, and then handling incompatible schemas, and schemas with missing or additional columns. The example then focuses on data issues, including handling the various loading options.
[!code-csharp[DataWorks DataTableLoad.LoadOption#1](~/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DataTableLoad.LoadOption/CS/source.cs#1)]
[!code-vb[DataWorks DataTableLoad.LoadOption#1](~/samples/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DataTableLoad.LoadOption/VB/source.vb#1)]
]]></format>
</remarks>
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
<related type="Article" href="https://msdn.microsoft.com/library/62f404a5-13ea-4b93-a29f-55b74a16c9d3">Working with DataTable Events</related>
</Docs>
</Member>
<Member MemberName="Load">
<MemberSignature Language="C#" Value="public virtual void Load (System.Data.IDataReader reader, System.Data.LoadOption loadOption, System.Data.FillErrorEventHandler errorHandler);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void Load(class System.Data.IDataReader reader, valuetype System.Data.LoadOption loadOption, class System.Data.FillErrorEventHandler errorHandler) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Data.DataTable.Load(System.Data.IDataReader,System.Data.LoadOption,System.Data.FillErrorEventHandler)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual void Load(System::Data::IDataReader ^ reader, System::Data::LoadOption loadOption, System::Data::FillErrorEventHandler ^ errorHandler);" />
<MemberSignature Language="F#" Value="abstract member Load : System.Data.IDataReader * System.Data.LoadOption * System.Data.FillErrorEventHandler -&gt; unit&#xA;override this.Load : System.Data.IDataReader * System.Data.LoadOption * System.Data.FillErrorEventHandler -&gt; unit" Usage="dataTable.Load (reader, loadOption, errorHandler)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="reader" Type="System.Data.IDataReader" Index="0" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1" />
<Parameter Name="loadOption" Type="System.Data.LoadOption" Index="1" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1" />
<Parameter Name="errorHandler" Type="System.Data.FillErrorEventHandler" Index="2" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1" />
</Parameters>
<Docs>
<param name="reader">A <see cref="T:System.Data.IDataReader" /> that provides a result set.</param>
<param name="loadOption">A value from the <see cref="T:System.Data.LoadOption" /> enumeration that indicates how rows already in the <see cref="T:System.Data.DataTable" /> are combined with incoming rows that share the same primary key.</param>
<param name="errorHandler">A <see cref="T:System.Data.FillErrorEventHandler" /> delegate to call when an error occurs while loading data.</param>
<summary>Fills a <see cref="T:System.Data.DataTable" /> with values from a data source using the supplied <see cref="T:System.Data.IDataReader" /> using an error-handling delegate.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The `Load` method consumes the first result set from the loaded <xref:System.Data.IDataReader>, and after successful completion, sets the reader's position to the next result set, if any. When converting data, the `Load` method uses the same conversion rules as the <xref:System.Data.Common.DbDataAdapter.Fill%2A?displayProperty=nameWithType> method.
The `Load` method must take into account three specific issues when loading the data from an <xref:System.Data.IDataReader> instance: schema, data, and event operations. When working with the schema, the `Load` method may encounter conditions as described in the following table. The schema operations take place for all imported result sets, even those containing no data.
|Condition|Behavior|
|---------------|--------------|
|The <xref:System.Data.DataTable> has no schema.|The `Load` method infers the schema based on the result set from the imported <xref:System.Data.IDataReader>.|
|The <xref:System.Data.DataTable> has a schema, but it is incompatible with the loaded schema.|The `Load` method throws an exception corresponding to the particular error that occurs when attempting to load data into the incompatible schema.|
|The schemas are compatible, but the loaded result set schema contains columns that don't exist in the `DataTable`.|The `Load` method adds the extra column(s) to `DataTable`'s schema. The method throws an exception if corresponding columns in the <xref:System.Data.DataTable> and the loaded result set are not value compatible. The method also retrieves constraint information from the result set for all added columns. Except for the case of Primary Key constraint, this constraint information is used only if the current <xref:System.Data.DataTable> does not contain any columns at the start of the load operation.|
|The schemas are compatible, but the loaded result set schema contains fewer columns than does the `DataTable`.|If a missing column has a default value defined or the column's data type is nullable, the `Load` method allows the rows to be added, substituting the default or null value for the missing column. If no default value or null can be used, then the `Load` method throws an exception. If no specific default value has been supplied, the `Load` method uses the null value as the implied default value.|
Before considering the behavior of the `Load` method in terms of data operations, consider that each row within a <xref:System.Data.DataTable> maintains both the current value and the original value for each column. These values may be equivalent, or may be different if the data in the row has been changed since filling the `DataTable`. See [Row States and Row Versions](~/docs/framework/data/adonet/dataset-datatable-dataview/row-states-and-row-versions.md) for more information.
In this method call, the specified <xref:System.Data.LoadOption> parameter influences the processing of the incoming data. How should the Load method handle loading rows that have the same primary key as existing rows? Should it modify current values, original values, or both? These issues, and more, are controlled by the `loadOption` parameter.
If the existing row and the incoming row contain corresponding primary key values, the row is processed using its current row state value, otherwise it's treated as a new row.
In terms of event operations, the <xref:System.Data.DataTable.RowChanging> event occurs before each row is changed, and the <xref:System.Data.DataTable.RowChanged> event occurs after each row has been changed. In each case, the <xref:System.Data.DataRowChangeEventArgs.Action%2A> property of the <xref:System.Data.DataRowChangeEventArgs> instance passed to the event handler contains information about the particular action associated with the event. This action value varies, depending on the state of the row before the load operation. In each case, both events occur, and the action is the same for each. The action may be applied to either the current or original version of each row, or both, depending on the current row state.
The following table displays behavior for the Load method when called with each of the `LoadOption` values, and also shows how the values interact with the row state for the row being loaded. The final row (labeled "(Not present)") describes the behavior for incoming rows that don't match any existing row. Each cell in this table describes the current and original value for a field within a row, along with the <xref:System.Data.DataRowState> for the value after the `Load` method has completed.
|Existing DataRowState|Upsert|OverwriteChanges|PreserveChanges (Default behavior)|
|---------------------------|------------|----------------------|------------------------------------------|
|Added|Current = \<Incoming><br /><br /> Original = -\<Not available><br /><br /> State = \<Added><br /><br /> RowAction = Change|Current = \<Incoming><br /><br /> Original = \<Incoming><br /><br /> State = \<Unchanged><br /><br /> RowAction = ChangeCurrentAndOriginal|Current = \<Existing><br /><br /> Original = \<Incoming><br /><br /> State = \<Modified><br /><br /> RowAction = ChangeOriginal|
|Modified|Current = \<Incoming><br /><br /> Original = \<Existing><br /><br /> State = \<Modified><br /><br /> RowAction = Change|Current = \<Incoming><br /><br /> Original = \<Incoming><br /><br /> State = \<Unchanged><br /><br /> RowAction = ChangeCurrentAndOriginal|Current = \<Existing><br /><br /> Original = \<Incoming><br /><br /> State = \<Modified><br /><br /> RowAction =ChangeOriginal|
eleted|(Load does not affect deleted rows)<br /><br /> Current = ---<br /><br /> Original = \<Existing><br /><br /> State = \<Deleted><br /><br /> (New row is added with the following characteristics)<br /><br /> Current = \<Incoming><br /><br /> Original = \<Not available><br /><br /> State = \<Added><br /><br /> RowAction = Add|Undo delete and<br /><br /> Current = \<Incoming><br /><br /> Original = \<Incoming><br /><br /> State = \<Unchanged><br /><br /> RowAction = ChangeCurrentAndOriginal|Current = \<Not available><br /><br /> Original = \<Incoming><br /><br /> State = \<Deleted><br /><br /> RowAction = ChangeOriginal|
|Unchanged|Current = \<Incoming><br /><br /> Original = \<Existing><br /><br /> If new value is the same as the existing value then<br /><br /> State = \<Unchanged><br /><br /> RowAction = Nothing<br /><br /> Else<br /><br /> State = \<Modified><br /><br /> RowAction = Change|Current = \<Incoming><br /><br /> Original = \<Incoming><br /><br /> State = \<Unchanged><br /><br /> RowAction = ChangeCurrentAndOriginal|Current = \<Incoming><br /><br /> Original = \<Incoming><br /><br /> State = \<Unchanged><br /><br /> RowAction = ChangeCurrentAndOriginal|
Not present)|Current = \<Incoming><br /><br /> Original = \<Not available><br /><br /> State = \<Added><br /><br /> RowAction = Add|Current = \<Incoming><br /><br /> Original = \<Incoming><br /><br /> State = \<Unchanged><br /><br /> RowAction = ChangeCurrentAndOriginal|Current = \<Incoming><br /><br /> Original = \<Incoming><br /><br /> State = \<Unchanged><br /><br /> RowAction = ChangeCurrentAndOriginal|
Values in a <xref:System.Data.DataColumn> can be constrained through use of properties such as <xref:System.Data.DataColumn.ReadOnly%2A> and <xref:System.Data.DataColumn.AutoIncrement%2A>. The `Load` method handles such columns in a manner that is consistent with the behavior defined by the column's properties. The read only constraint on a <xref:System.Data.DataColumn> is applicable only for changes that occur in memory. The `Load` method's overwrites the read-only column values, if needed.
If you specify the OverwriteChanges or PreserveChanges options when calling the `Load` method, then the assumption is made that the incoming data is coming from the `DataTable`'s primary data source, and the DataTable tracks changes and can propagate the changes back to the data source. If you select the Upsert option, it is assumed that the data is coming from one of a secondary data source, such as data provided by a middle-tier component, perhaps altered by a user. In this case, the assumption is that the intent is to aggregate data from one or more data sources in the `DataTable`, and then perhaps propagate the data back to the primary data source. The <xref:System.Data.LoadOption> parameter is used for determining the specific version of the row that is to be used for primary key comparison. The table below provides the details.
|Load option|DataRow version used for primary key comparison|
|-----------------|-----------------------------------------------------|
|`OverwriteChanges`|Original version, if it exists, otherwise Current version|
|`PreserveChanges`|Original version, if it exists, otherwise Current version|
|`Upsert`|Current version, if it exists, otherwise Original version|
The `errorHandler` parameter is a <xref:System.Data.FillErrorEventHandler> delegate that refers to a procedure that is called when an error occurs while loading data. The <xref:System.Data.FillErrorEventArgs> parameter passed to the procedure provides properties that allow you to retrieve information about the error that occurred, the current row of data, and the <xref:System.Data.DataTable> being filled. Using this delegate mechanism, rather than a simpler try/catch block, allows you to determine the error, handle the situation, and continue processing if you like. The <xref:System.Data.FillErrorEventArgs> parameter supplies a <xref:System.Data.FillErrorEventArgs.Continue%2A> property: set this property to `true` to indicate that you have handled the error and wish to continue processing. Set the property to `false` to indicate that you wish to halt processing. Be aware that setting the property to `false` causes the code that triggered the problem to throw an exception.
## Examples
[!code-csharp[DataWorks DataTableLoad.ErrorEventHandler#1](~/samples/snippets/csharp/VS_Snippets_ADO.NET/DataWorks DataTableLoad.ErrorEventHandler/CS/source.cs#1)]
[!code-vb[DataWorks DataTableLoad.ErrorEventHandler#1](~/samples/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks DataTableLoad.ErrorEventHandler/VB/source.vb#1)]
]]></format>
</remarks>
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
<related type="Article" href="https://msdn.microsoft.com/library/62f404a5-13ea-4b93-a29f-55b74a16c9d3">Working with DataTable Events</related>
</Docs>
</Member>
<MemberGroup MemberName="LoadDataRow">
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Finds and updates a specific row. If no matching row is found, a new row is created using the given values.</summary>
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
</Docs>
</MemberGroup>
<Member MemberName="LoadDataRow">
<MemberSignature Language="C#" Value="public System.Data.DataRow LoadDataRow (object[] values, bool fAcceptChanges);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.Data.DataRow LoadDataRow(object[] values, bool fAcceptChanges) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Data.DataTable.LoadDataRow(System.Object[],System.Boolean)" />
<MemberSignature Language="VB.NET" Value="Public Function LoadDataRow (values As Object(), fAcceptChanges As Boolean) As DataRow" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; System::Data::DataRow ^ LoadDataRow(cli::array &lt;System::Object ^&gt; ^ values, bool fAcceptChanges);" />
<MemberSignature Language="F#" Value="member this.LoadDataRow : obj[] * bool -&gt; System.Data.DataRow" Usage="dataTable.LoadDataRow (values, fAcceptChanges)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Data</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Data.Common</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Data.DataRow</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="values" Type="System.Object[]" Index="0" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1" />
<Parameter Name="fAcceptChanges" Type="System.Boolean" Index="1" FrameworkAlternate="netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netstandard-2.1" />
</Parameters>
<Docs>
<param name="values">An array of values used to create the new row.</param>
<param name="fAcceptChanges">
<see langword="true" /> to accept changes; otherwise <see langword="false" />.</param>
<summary>Finds and updates a specific row. If no matching row is found, a new row is created using the given values.</summary>
<returns>The new <see cref="T:System.Data.DataRow" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Data.DataTable.LoadDataRow%2A> method takes an array of values and finds the matching value(s) in the primary key column(s).
If a column has a default value, pass a null value in the array to set the default value for that column. Similarly, if a column has its <xref:System.Data.DataColumn.AutoIncrement%2A> property set to true, pass a null value in the array to set the automatically generated value for the row.
If the `fAcceptChanges` parameter is `true` or not specified, the new data is added and then <xref:System.Data.DataTable.AcceptChanges%2A> is called to accept all changes in the <xref:System.Data.DataTable>; if the argument is `false`, newly added rows are marked as insertions, and changes to existing rows are marked as modifications.
Exceptions can also occur during either a <xref:System.Data.DataTable.ColumnChanging> or <xref:System.Data.DataTable.RowChanging> event. If an exception occurs, the row is not added to the table.
Use <xref:System.Data.DataTable.LoadDataRow%2A> in conjunction with <xref:System.Data.DataTable.BeginLoadData%2A> and <xref:System.Data.DataTable.EndLoadData%2A>.
## Examples
The following example uses the <xref:System.Data.DataTable.LoadDataRow%2A> method to attempt to find a row. If no such row is found, the values are used to create a new row.
[!code-csharp[Classic WebData DataTable.LoadDataRow Example#1](~/samples/snippets/csharp/VS_Snippets_ADO.NET/Classic WebData DataTable.LoadDataRow Example/CS/source.cs#1)]
[!code-vb[Classic WebData DataTable.LoadDataRow Example#1](~/samples/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataTable.LoadDataRow Example/VB/source.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">The array is larger than the number of columns in the table.</exception>
<exception cref="T:System.InvalidCastException">A value doesn't match its respective column type.</exception>
<exception cref="T:System.Data.ConstraintException">Adding the row invalidates a constraint.</exception>
<exception cref="T:System.Data.NoNullAllowedException">Attempting to put a null in a column where <see cref="P:System.Data.DataColumn.AllowDBNull" /> is false.</exception>
<related type="Article" href="https://msdn.microsoft.com/library/52ff0e32-3e5a-41de-9a3b-7b04ea52b83e">Creating and Using DataTables</related>
<related type="Article" href="https://msdn.microsoft.com/library/62f404a5-13ea-4b93-a29f-55b74a16c9d3">Working with DataTable Events</related>