Can I do a very large insert with Linq-to-SQL?

前端 未结 4 796
醉酒成梦
醉酒成梦 2021-01-15 01:13

I\'ve got some text data that I\'m loading into a SQL Server 2005 database using Linq-to-SQL using this method (psuedo-code):

Create a DataContext

While (ne         


        
4条回答
  •  感情败类
    2021-01-15 01:31

    It looks like this would work however the changes (and thus memory) that are kept by the DataContext are going to grow with each InsertOnSubmit. Maybe it's adviseable to perform a SubmitChanges every 100 records?

    I would also take a look at SqlBulkCopy to see if it doesn't fit your usecase better.

提交回复
热议问题