Click here to Skip to main content
15,907,149 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
How to copy one Datatable to another datatable using asp.net C# give one
example to solve this solution.
Posted
Updated 1-Nov-12 4:39am
v2
Comments
nira.parmar 1-Nov-12 9:50am    
Directly assign first datatable value to another
like this
datatable dt1= new datatable();
datatable dt2=new datatable();
dt1=dt2;
[no name] 1-Nov-12 10:27am    
Are you using a DataSet?
fjdiewornncalwe 1-Nov-12 10:41am    
You will learn much more by making a concerted effort to do your own homework and asking questions only when you get stuck in the process. This particular question can very simply be answered by either rechecking your course notes or by a simple google search. If you are serious about becoming a good developer then you will learn best by struggling through problems you find difficult.

 
Share this answer
 
DataTable dtNew=yourOldDL.Copy();//it will copy data and structure

DataTable dtNew=yourOldDL.Clone();//it will copy structure only
 
Share this answer
 
Hi
Please try the following code for the copy one table to other.

C#
DataTableNew = DataTableOld.Copy();


I hope you are talking about the .NET datatable not the Database Tables.
 
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