How to reject changes between two equal DataTables?
-
Dear All, I have two DataTables. The first (FirstDataTable) is filled by a query and the second is filled by: SecondDataTable= FirstDataTable; after this equal operation, the two DataTables are connected and any change is reflected between the both. I mean when you change the data in the FirstDataTable by a different query, this change will be reflected to the SecondDataTable automatically. The question here: How can I stop or reject the connection between the two DataTables. I mean I do not want to reflect the changes after the equal operation. this is to make a copy of the first data returned by the first run of the query. Regards.
Kind Regards OBarahmeh
-
Dear All, I have two DataTables. The first (FirstDataTable) is filled by a query and the second is filled by: SecondDataTable= FirstDataTable; after this equal operation, the two DataTables are connected and any change is reflected between the both. I mean when you change the data in the FirstDataTable by a different query, this change will be reflected to the SecondDataTable automatically. The question here: How can I stop or reject the connection between the two DataTables. I mean I do not want to reflect the changes after the equal operation. this is to make a copy of the first data returned by the first run of the query. Regards.
Kind Regards OBarahmeh
obarahmeh wrote:
SecondDataTable= FirstDataTable;
This means both tables are referring to the same object in memory. What you can do is, create a deep copy of the FirstDataTable. You can find a lot of examples on web for doing this.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!