About datatables

  • Thread starter Thread starter Ravindra
  • Start date Start date
R

Ravindra

Hi

How to pass the content of one data table to another data table.I simply
tried using assignment operator...Example: datatable1=datatable2...But,its
not working..

ravindra
 
Ravindra,
How to pass the content of one data table to another data table.I simply
tried using assignment operator...Example: datatable1=datatable2...But,its
not working..
It depends what you want, if you want a copy of datatable2 in datatable1 one
than you can use the DataTable.copy command. What you are doing now is
setting the reference of datatable2 to datatable1 as well.

If you want the content to be copied than

datatable1 = datatable2.copy

I hope this helps,

Cor
 
yeah we used merge method, but the error "merge is not a method of
system.data.datatable" occured.
Miha Markic said:
Use DataTable.Merge method

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Ravindra said:
Hi

How to pass the content of one data table to another data table.I simply
tried using assignment operator...Example:
datatable1=datatable2...But,its not working..

ravindra
 
I think the DataTable.Merge works on the 2.0 Framework?

I think in your case, you can enumerate the rows and use the
LoadDataRow method of the Datatable.
 
I think the DataTable.Merge works on the 2.0 Framework?

I think in your case, you can enumerate the rows and use the
LoadDataRow method of the Datatable.
 
Skanda Subramanian said:
I think the DataTable.Merge works on the 2.0 Framework?

Right, is anybody still using .net 1.x? ;-)
I think in your case, you can enumerate the rows and use the
LoadDataRow method of the Datatable.

Or put datatables into a dataset, make sure that both have same name and do
a DataSet.Merge
 
Back
Top