There are several ways a
DataSet
can be
created. In the simplest case, a DataSet
is
created using the new
keyword. The constructor
accepts on optional argument that allows the
DataSetName
property to be set. If the
DataSetName
argument isn’t
supplied, the default name of the DataSet
will be
NewDataSet
.
DataSet ds = new DataSet("MyDataSet");
A DataSet
can also be created from another
DataSet
. The Copy( )
method can create a new
DataSet
containing both the schema and data from
the original DataSet
. The Clone( )
method creates a new DataSet
with the same schema,
but none of the data of the original. Finally, the
GetChanges( )
method creates a new DataSet
containing data that
has changed since the DataSet
was last loaded or
the pending changes were accepted. These methods will be discussed in
more detail later in this chapter.