Interviews - C# Corner

Purushottam Rathore
What is difference between Dataset.clone and Dataset.copy?
By Purushottam Rathore in ADO.NET onJun 08 2011
  • Pankaj Gogoi
    Jun, 2011 17

    DataSet.Clone()

    Copies the structure of the dataset, including all DataTable schemas,relations and constraints. Does not copy any data.

    DataSet.Copy()
    Copies both the structure and data for a DataSet. You use copy method when you don't want to affect the original data.

    • 0
  • Dinkar Chavhan
    Jun, 2011 10


    DataSet.Clone() would copy only the schema of the DataSet object and it would return the DataSet object that has same struture that the previous dataset object which includes all the relations, constraints and schemas as well. This will not copy the data from the existing one to new one.

    The existing Dataset ---

    private DataSet CreateMyClone(DataSet myCloneDataSet)

    {

    DataSet exampleCloneDS;

    exampleCloneDS = myCloneDataSet.Clone();

    return exampleCloneDS;

    }




    DataSet.Copy() will copy complete code as well as the structure of the existing DataSet object

    • 0
  • Purushottam Rathore
    Jun, 2011 8

    Dataset.Clone- It only copies structure, does not copy data.
    Dataset.Copy - Copies both structure and data.

    • 0

Most Popular Companies

Most Popular Job Functions

MOST LIKED QUESTIONS