Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi

iam trying to insert data one table to another table.
iam using below method.
but in the source table show empty at the run time.

so please give me idea how to access the data in to my source table.


foreach (DataRow dr in sourceTable.Rows)
{
destinationTable.ImportRow(dr);
}
Posted
Comments
Varun Sareen 2-Mar-12 0:17am    
Dear Friend, you have to fill the data into your source table in order to copy the same into the destination table
Dinesh Mani 2-Mar-12 0:20am    
why do you want to duplicate data between two tables? Is this duplication at the database level or only in the application level? if you just wish to duplicate the data try the clone method on the datatable object.

And your source datatable is empty either because you have not filled it yet or the orignial data source to your datatable is empty.
ProEnggSoft 2-Mar-12 6:10am    
This is repost of your question
http://www.codeproject.com/Answers/338584/Import-data-one-table-to-another-table-using-Forlo
instead of reposting please follow earlier question thread by posting your queries.

1 solution

You can use the copy method to copy the data of one table to other
e.e destinationtable=soucretable.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