Click here to Skip to main content
15,883,883 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi All,

I am using a DataTable in my application with Linq for insertion, updation and Deletion. I have used the nos. and name of column same as in Database.

I want to convert this DataTable into Generic List and then Insert all record in Database with InsertAllonSubmit.

So Please let me know the way Convert DataTable to Generic List or any another way to insert DataTable into Database with single trip without using SqlBulkCopy.

Regards!
Aman
Posted
Updated 14-Mar-11 0:45am
v2

LinQ Data Context has a SubmitChanges() which updates all changes in the data context objects.

Create new objects, then add it to the Data context collections. Finally call the SubmitChanges function

Is that function doesn't helps?

If you want to know more about this function, have a look at here.

http://weblogs.asp.net/scottgu/archive/2007/07/11/linq-to-sql-part-4-updating-our-database.aspx[^]
 
Share this answer
 
Comments
Aman4.net 14-Mar-11 7:40am    
Thanx for your reply...
 
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