Click here to Skip to main content
15,887,875 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am having two typed dataset namely dset1 and dset2.

I just assigned first dataset to second dataset by

dset2=dset1;

When I do the above thing whenever a change happens to first dataset dset1 it reflects to dset2.

So I need to copy using ReadXML and WriteXML method.

Please help me to get rid of this problem.
Posted
Updated 11-Nov-14 23:04pm
v2
Comments
Kornfeld Eliyahu Peter 12-Nov-14 2:27am    
Not clear! Are you want to clone dset1 to dset2 so you have to separate datasets with the same initial data, but changes on one do not reflect on the other?

1 solution

Since .NET FrameWork 1.1, the System.Data NameSpace provides a DataSet.Copy method which will create: "A new DataSet with the same structure (table schemas, relations, and constraints) and data as this DataSet."

Just do it:
C#
DataSet copyDataSet = OriginalDataSet.Copy();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900